-
Notifications
You must be signed in to change notification settings - Fork 16
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
add conditional to avoid loading unexisting apps. Fixes #58 #59
Conversation
I think this fixes one of the problems....but I don't think it addresses the TaskResult issue. I think the issue there is that the instance is in a transaction. So when the task try's to re-pull the object it gets a DB error. Maybe just a try/catch on that error handles this? |
I just added the try/catch. I guess that if the instance does not exists, the task should do nothing, right? |
Yeah, the only other thing I can think of is involving transaction.on_commit somehow but not sure if that would even work. I'd say the current solution is good enough to get this patched. |
Thank you for your reports and the PR! I get the problem with transactions raising a Regardless, I think the following comment made by @JordanHyatt makes sense and we should avoid sending "useless" tasks to Celery if possible:
So in my opinion the In the meantime I'll check why docker-compose is suddenly unavailable in actions 🙃. |
I also think we should mention the transaction edge case in the documentation, maybe below |
I agree. I guess I didn't realize the PR was doing it in the actual signal function. Honestly, thinking about it more, invoking |
Also while we are on the subject....shouldn't those task calls be using the handle_save_task.delay method ? Otherwise they just get run in the same thread |
In that case, checking if we're in a transaction with This way the exception will happen on the main thread, which can be better since an exception in Celery might be overlooked.
Uh, that's a major oversight on my part 😓, thanks for catching it. This make the processor kinda pointless. @jlariza Can you add this to your MR ? |
By the way, I fixed the actions, rebasing on |
Also I think we should add a method (
the method would basically do the same logic update has.... I'm happy to write the code, but I don't want too many cooks in the kitchen.....just let me know! |
…the model instance is not available
…task. Runs the tasks with .delay
3763999
to
48460d2
Compare
@qcoumes @JordanHyatt code updated. Please, check. Thank you |
48460d2
to
08e1e3c
Compare
We are getting there! I think we need to improve the logic of whether to invoke the task. what you currently have will not send if its a related instance, which we still want. Also I think this check should be applied to delete as well. this is what I have, let me know what you think! We are currently using this custom Processor in our code base and it seems to be working well, obviously needs unit tests though.
|
We indeed also need to check for related instances. I like the idea of the |
Hey team, I submitted a new PR in an attempt to get this important patch pushed through. |
sorry @JordanHyatt @qcoumes I was a little busy last week. Thanks for the new PR. |
Validates that the app label is in the available configs before retrieving the model instance to index. Fixes #58