-
Notifications
You must be signed in to change notification settings - Fork 10
fix: Invoke destroy handler in batch mode #32
fix: Invoke destroy handler in batch mode #32
Conversation
5cdcb4e
to
63a3449
Compare
} else { | ||
if (!watcherStarted) { | ||
for (const meta of metaByAction.values()) { | ||
meta?.onDestroyHandler?.(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, @beshanoe what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephan-noel I dont get why would you assign a to the batchMeta the first encountered action's meta? probably you can assign there only a batch's onDestroyHandler? Can you please push into this PR a whole solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beshanoe you're right, I was only considering my own use case in which I need context.longRunning
to only be called once per runner.
I guess maybe there are several approaches here:
- Call
context.longRunning
once per runner (NOT per project per runner) like I do above. If you want to handle shutdown for several projects, you can do something like (ignore the invocation of onetime below) :
- Call context.longRunning once per action (the approach you were expecting of per project per runner), and if the cleanup had already been done by a previous project (ie, the projects shared the same port and I already closed it), then I have to detect that it was already cleaned up or limit it the invocations somehow.
Honestly the first approach seemed more natural to me, but I may be biased to my use case, what are your thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beshanoe Changed it a bit to separate the non-batch meta from batchMeta. I do set and get for batchMetaByAction where I do to bring attention to the fact that having one meta per action instead of per runner is a possibility in the future. What do you think?
40c62fe
to
a719d6b
Compare
a719d6b
to
3119df4
Compare
3119df4
to
ee26e03
Compare
ee26e03
to
b5d1efe
Compare
Description
Invoke destroy handler for project dependent tasks after batch task was finished.
Fixes #31
Checklist:
Disclaimer
By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement