want to ask one more thing, what would be the preferred way to keep the job instances per each method? so I can cancel granularly?
g
gildor
07/16/2019, 11:21 PM
Per each method? Just save job to some property
u
ursus
07/16/2019, 11:51 PM
right, but scope already keeps that, should I mirror the map manually?
s
streetsofboston
07/17/2019, 1:13 AM
Each call to
launch
or
async
returns a
Job
, which you can cancel. The scope's Job is their parent-Job.
➕ 1
g
gildor
07/17/2019, 4:23 AM
Scope doesn't keep reference on child jobs, it's opposite, child jobs are keeping reference on parent, so if you want to cancel them separately you should save them somehow. Tho, parent can cancel all child jobs together
a
Antanas A.
07/17/2019, 8:41 AM
@gildor does it really only child references a parent?
Because I see that Job has "children" getter public val children: Sequence<Job>
so also a parent must have references to all children (maybe not object references), but some kind of relationships exists in both directions