linkedin / linkedin/parseq

Auto-run the Task that is returned from Task.run

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
268
PR merge metrics
No merged PRs in 30d

Description

This has been raised as a surprise by several people - most recently by @jhartman. The behavior of ParSeq differs between core ParSeq, Play, and Restli. ParSeq and Play require Tasks to be explicitly run. Restli auto-runs the returned Task.

In an environment where users are using `seq` / `par`, the auto-run behavior is most intuitive. In an environment where users are using `context.after`, the opposite is true. Here's an example where auto-run would do the wrong thing:

``` java
final Task parent = new BaseTask()
{
@Override
protected Promise run(final Context context) throws Exception
{
context.after(a).run(b);
context.after(a).run(c);
context.after(b, c).run(d);
context.run(a);
return d;
}
};
```

With auto run we'd try to run `d` before `b` and `c`. However, `context.after` is intended as a low-level construct for building up more user friendly tasks, such as the above mentioned `seq` and `par`, so it seems better to make run handling special for `context.after` and not the other way around.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing how core ParSeq, Play, and Restli handle Tasks returned from Task.run, then read the example involving context.after, context.run, seq, and par. The change is complete when the intended auto-run behavior is decided and implemented without attempting to run d before b and c in the shown dependency setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.