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

running prune thread directly in gunicorn #44

Closed
wants to merge 5 commits into from
Closed

Conversation

missytake
Copy link
Contributor

I figured out a way to run threads from the gunicorn main process. This is a prerequisite for #36. We can use this to run all mailadm threads in the same docker container.

Reference:

I added a small watcher thread which will kill the whole process/container if the prune thread dies. This can be extended to the bot thread when we add it in #23. Also, all our threads are daemon threads - together, this ensures that the whole container dies if any of the gunicorn, prune, or bot threads fails, and can be restarted by docker.

In the long term I want to move the app.prune() function to commands.py or something, but this doesn't exist yet on master, so I just added it to app.py for now. It's a bit against DRY, but let's do this properly after #23 is merged.

@missytake missytake changed the title running prune thread directly in gunicorn WIP: running prune thread directly in gunicorn Jul 24, 2022
@missytake
Copy link
Contributor Author

missytake commented Jul 24, 2022

I tested it with docker already:

  • the prune thread starts
  • it also exits on error (I moved the DB away to kill the prune thread, that killed the container as well)
  • except with a keyboard interrupt I couldn't check whether everything dies when gunicorn dies so far.
  • who watches the watcher?

@missytake missytake changed the title WIP: running prune thread directly in gunicorn running prune thread directly in gunicorn Jul 24, 2022
@missytake missytake requested a review from hpk42 July 24, 2022 09:22
@missytake
Copy link
Contributor Author

Closing this in favor of #45, actually this is much more useful in the bot development than on master right now.

@missytake missytake closed this Jul 25, 2022
@missytake missytake deleted the prune-thread branch July 25, 2022 07:44
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

Successfully merging this pull request may close these issues.

1 participant