mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Batches eve_api updates in batches of 50, allows for gradual updates throughout the day
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
ROOT=/home/matalok/auth/auth
|
||||
|
||||
@daily $ROOT/run-cron.py reddit.cron UpdateAPIs
|
||||
@daily $ROOT/run-cron.py reddit.cron UpdateAPIs
|
||||
*/10 * * * * $ROOT/run-cron.py reddit.cron ProcessValidations
|
||||
@hourly $ROOT/run-cron.py eve_api.cron UpdateAPIs
|
||||
@hourly * * * * $ROOT/run-cron.py sso.cron RemoveInvalidUsers > $ROOT/auth-update.log 2>&1
|
||||
*/5 * * * * $ROOT/run-cron.py eve_api.cron UpdateAPIs
|
||||
@hourly $ROOT/run-cron.py sso.cron RemoveInvalidUsers > $ROOT/auth-update.log 2>&1
|
||||
|
||||
@@ -13,6 +13,7 @@ class UpdateAPIs():
|
||||
settings = { 'update_corp': False }
|
||||
|
||||
last_update_delay = 86400
|
||||
batches = 50
|
||||
|
||||
@property
|
||||
def _logger(self):
|
||||
@@ -26,7 +27,7 @@ class UpdateAPIs():
|
||||
delta = datetime.timedelta(seconds=self.last_update_delay)
|
||||
self._logger.debug("Updating APIs older than %s" % (datetime.datetime.now() - delta))
|
||||
|
||||
accounts = EVEAccount.objects.filter(api_last_updated__lt=(datetime.datetime.now() - delta))
|
||||
accounts = EVEAccount.objects.filter(api_last_updated__lt=(datetime.datetime.now() - delta))[:batches]
|
||||
self._logger.debug("%s account(s) to update" % len(accounts))
|
||||
for acc in accounts:
|
||||
self._logger.info("Updating UserID %s" % acc.api_user_id)
|
||||
|
||||
Reference in New Issue
Block a user