Skip to content

Commit

Permalink
Schedule jobs accordingly.
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Mar 16, 2019
1 parent d90780b commit fc69425
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pybossa/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def get_periodic_jobs(queue):
autoimport_jobs = get_autoimport_jobs() if queue == 'low' else []
# User engagement jobs
engage_jobs = get_inactive_users_jobs() if queue == 'quaterly' else []
warning_jobs = get_notify_inactive_accounts() if queue == 'low'
delete_account_jobs = get_delete_inactive_accounts() if queue == 'monthly'
non_contrib_jobs = get_non_contributors_users_jobs() \
if queue == 'quaterly' else []
dashboard_jobs = get_dashboard_jobs() if queue == 'low' else []
Expand Down Expand Up @@ -888,7 +890,7 @@ def delete_file(fname, container):
return uploader.delete_file(fname, container)
def get_notify_inactive_accounts(queue='super'):
def get_notify_inactive_accounts(queue='low'):
"""Return a list of inactive users."""
from sqlalchemy.sql import text
from pybossa.model.user import User
Expand Down Expand Up @@ -936,7 +938,7 @@ def get_notify_inactive_accounts(queue='super'):
yield job
def get_delete_inactive_accounts(queue='super'):
def get_delete_inactive_accounts(queue='monthly'):
"""Return a list of inactive users to delete."""
from sqlalchemy.sql import text
from pybossa.model.user import User
Expand Down
4 changes: 2 additions & 2 deletions test/test_jobs/test_delete_inactive_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_get_notify_returns_jobs(self):
assert email in emails, (email, emails)
job = jobs[0]
args = job['args'][0]
assert job['queue'] == 'super', job['queue']
assert job['queue'] == 'low', job['queue']
assert len(args['recipients']) == 1
assert args['recipients'][0] == tr_year.user.email_addr, args['recipients'][0]
assert "deleted the next month" in args['subject']
Expand Down Expand Up @@ -141,4 +141,4 @@ def test_delete_jobs(self):
assert job['args'][0] == tr_year.user.id, err_msg
job = jobs[0]
args = job['args'][0]
assert job['queue'] == 'super', job['queue']
assert job['queue'] == 'monthly', job['queue']

0 comments on commit fc69425

Please sign in to comment.