Skip to content
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

Better handle time-sensitive conditions #25

Closed
shaunagm opened this issue Apr 6, 2020 · 1 comment
Closed

Better handle time-sensitive conditions #25

shaunagm opened this issue Apr 6, 2020 · 1 comment

Comments

@shaunagm
Copy link
Collaborator

shaunagm commented Apr 6, 2020

On the backend, we re-run a condition when a new action is taken on it, but what about when the condition times out, for instance when the voting period in a voting condition expires? Not only is there no way on the front end to poll open conditions, we don't even have a mechanism on the backend.

Furthermore, on the front end: when a condition passes and it updates the action on the backend, we don't necessarily know what to update on the front end. For instance, if a condition passes for "add_role", we don't know which role to add, or even that it was an add role action that is ready to go.

So we need two things. First, we need something on the backend that watches for conditions to time out. And then second, we need some way for the backend to tell the front end that an action has been implemented so it can update data appropriately.

One temporary hack is to create a method on actions_include that looks for all waiting conditions and refreshes them when the component is mounted; this would be a call to the server that actually re-runs the condition and, if the condition changes status, would then automatically re-run the action. Not sure how the data would make it back to the front end though. Presumably there's something that can be done that's a push to the front end, rather than a pull from it?

@shaunagm shaunagm mentioned this issue Apr 29, 2020
6 tasks
@shaunagm
Copy link
Collaborator Author

shaunagm commented May 9, 2020

Okay, the fix for now is the new management command check_conditional_status which goes through all conditions, looks for those of a class with attribute "has_timeout" and if there's a timeout, checks to see if timeout has happened. If it has, it sends a signal to re-run the associated action. It's not very efficient, since this is going to rerun every condition that has ever timed out, but we can fix that inefficiency later.

Once this site is in production, I'll set up a chron job to call the command every five minutes or so.

Code is here: #40

@shaunagm shaunagm closed this as completed May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant