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

celery: add update_domain_status task #2903

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

carlinmack
Copy link
Contributor

❤️ Thank you for your contribution!

(Part of) Close #2777

Description

Please describe briefly your pull request.

Run update domain statistics task every hour. These statistics change when users create accounts, get blocked, etc

We simply never added a task to update these regularly

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@@ -429,6 +429,10 @@ def files_rest_permission_factory(obj, action):
"task": "invenio_accounts.tasks.delete_ips",
"schedule": timedelta(hours=6),
},
"update_domain_status": {
"task": "invenio_accounts.tasks.update_domain_status",
"schedule": timedelta(minutes=60),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"schedule": timedelta(minutes=60),
"schedule": timedelta(hours=4),

minor: a bit arbitrary, but since the underlying query is also performing updates to the database, I think seeing updates 2-3 times during working hours is good enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, the task doesn't update the index, just the db. Probably the task https://github.com/inveniosoftware/invenio-accounts/blob/24f9ac29879f2daa7e49c94c0370444fc4dc89aa/invenio_accounts/tasks.py#L81 should be updated to also index the domains that it changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI chose hourly as this comment says it ideally should be run regularly so that the changeset doesn't get too big https://github.com/inveniosoftware/invenio-accounts/blob/master/invenio_accounts/tasks.py#L123

Would probably be good to change it so that it doesn't require small changesets but I would like for some of my PRs to not result in fixing a larger issue 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we've updated the task to also reindex (using the bulk queue), I would say we merge and see if it needs adjustments in terms of the regularity, bulk size, or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating indexed shelved here inveniosoftware/invenio-accounts#502

@carlinmack carlinmack force-pushed the commit-domain branch 3 times, most recently from b8678c2 to cc2cb7f Compare November 8, 2024 15:21
Copy link

@zubeydecivelek zubeydecivelek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTU! Peer reviewed witj @jrcastro2

@jrcastro2 jrcastro2 merged commit 47b1df7 into inveniosoftware:master Nov 14, 2024
4 checks passed
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.

Domains: Existing Domains Not Visible on Admin Page After Login
5 participants