-
Notifications
You must be signed in to change notification settings - Fork 95
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
Unclear panic when using Client.Subscribe() when client is not executing jobs #596
Comments
Actually, might be better to make it work, if at all possible, rather than just clarifying the error? What I have a is a little CLI to manually schedule some jobs and then wait for them to be completed. This is useful sometimes. But I don't want this to start processing jobs; I just want it to wait until it's done. That is: wait for a worker to pick it up and run it. Unless I'm missing something, I think this currently isn't really possible (other than periodically calling |
Yeah, the error should be better, but what you're trying to do isn't going to work. A subscription isn't polling the database looking for completed jobs — rather, it's just sending back jobs that this particular client has worked. From the docs:
|
Right, yeah. that's fine – polling isn't too bad. |
…t work Related to #596. If `Subscribe` was called on a client that didn't have a `Workers` bundle configure a nil pointer panic would occur because `subscriptionManager` was never initialized. Here, leave that as a panic since it makes sense to warn a user about an API misuse that'd undoubtedly lead to more confusion/pain, but improve the error message so that it's more obvious to the caller why this is a problem. Fixes #596.
…t work Related to #596. If `Subscribe` was called on a client that didn't have a `Workers` bundle configure a nil pointer panic would occur because `subscriptionManager` was never initialized. Here, leave that as a panic since it makes sense to warn a user about an API misuse that'd undoubtedly lead to more confusion/pain, but improve the error message so that it's more obvious to the caller why this is a problem. Fixes #596.
…t work (#599) Related to #596. If `Subscribe` was called on a client that didn't have a `Workers` bundle configure a nil pointer panic would occur because `subscriptionManager` was never initialized. Here, leave that as a panic since it makes sense to warn a user about an API misuse that'd undoubtedly lead to more confusion/pain, but improve the error message so that it's more obvious to the caller why this is a problem. Fixes #596.
…t work (riverqueue#599) Related to riverqueue#596. If `Subscribe` was called on a client that didn't have a `Workers` bundle configure a nil pointer panic would occur because `subscriptionManager` was never initialized. Here, leave that as a panic since it makes sense to warn a user about an API misuse that'd undoubtedly lead to more confusion/pain, but improve the error message so that it's more obvious to the caller why this is a problem. Fixes riverqueue#596.
If I try to subscribe for job updates:
I get a panic:
The reason for this is that in
river.NewClient()
it does (abdriged):Which is reasonable and fair enough. I would expect a nicer message than a panic and having to read the source code to figure out why I get a panic. There isn't any error return, but just panic() with a nicer message is enough (this is clearly a programmer error, so it's probably an appropriate usage of panic).
The text was updated successfully, but these errors were encountered: