Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add runners to startup the ocis' services #8802
feat: add runners to startup the ocis' services #8802
Changes from 12 commits
ef32af6
da71059
0da6810
6ddc0ad
ff346c2
b6a6b61
5ea30f7
cb2e8e0
df3c496
59051e2
0d5756b
08c4763
05f684a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
something like this
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.
It will be done via helper functions (https://github.com/owncloud/ocis/pull/8802/files#diff-4fc1db913125260b4b30987a3e771134f13a1d1326d41231f311296c717645a1R28) if needed.
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.
Mmh. I don't think this is enough. A
GroupRunner
can be created with anyRunner
. There is no guarantee this is aInterruptedTimeoutRunner
. If I just call this with a broken customRunner
this will hang forever. We need the timeout here.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.
I think it's a matter of deciding who's responsible of ensuring the program won't hang forever.
My assumption is that the responsible is the one using the package, because he knows the task and how to stop the task, so there shouldn't be a reason for him to provide a faulty task (otherwise, it's a bug that he needs to fix). The
InterruptedTimeoutRunner
can help, knowing its limitations, to ensure we don't block the thread, but it's the developer's choice to use it or not.Basically, if the task hangs, it's your fault (whoever is using the package). Code comments should be clear in this regard (if it isn't clear enough, we should add more info about it).
If we're going to be responsible, there are a couple of important things to notice:
Note that, before, it was your responsibility to ensure this doesn't happen, but now it's ours, and we can't ensure it.
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.
I strongly disagree. If the task is broken for some reason the programm MUST still exit. It cannot hang forever saying "this is your fault, I don't care". Since this is supposed to be the
supervisor
of all tasks it MUST make sure its tasks finish after a certain amount of time.Why not? If we exit within the grouprunner, all resources of our spawned go routines should be freed.
I tend to disagree again. We could remove the complete
InterruptedTimeoutRunner
and replace it with only oneselect
statement. This would reduce complexity in my opinionThere 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.
@jvillafanez this comment is still open? Could you add the timeout here?
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.
The runner has a guaranteed exit with the timeout, so we'll eventually get a result. A deadlock isn't possible.
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.
I see. Does it really need to be that complicated? We now need another channel and another go-routine to make sure a result is delivered. We could omit all that with just one single line here:
Wouldn't this be much simpler?
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.
runner's
Run
andRunAsync
method as well as group runner'sRunAsync
method should behave the same way (returning a result after the timeout period has been reached). Just checking for the timeout there would mean that the timeout behavior would be exclusive for that method.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.
But that is exactly what it is. Only the
GroupRunner
cares about the timeout because it needs to govern several Runners. OneRunner
started alone doesn't necessarily need a timeout. It could deadlock forever if its creator wants it so. But theGroupRunner
needs to make sure it finishes in a reasonable amount of time.