Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1698)

Unified Diff: appengine/gce-backend/cleanup.py

Issue 2713533002: Refactor task enqueuing (Closed)
Patch Set: Remove metric Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/gce-backend/catalog.py ('k') | appengine/gce-backend/instance_group_managers.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/gce-backend/cleanup.py
diff --git a/appengine/gce-backend/cleanup.py b/appengine/gce-backend/cleanup.py
index 19c6f92a1ab181e2f3b2670df4958927b21d7ce1..7ef317dde91b5993f7327bd5a03bbd25fb4f7b6d 100644
--- a/appengine/gce-backend/cleanup.py
+++ b/appengine/gce-backend/cleanup.py
@@ -228,14 +228,7 @@ def schedule_deleted_instance_check():
"""Enqueues tasks to check for deleted instances."""
for instance in models.Instance.query():
if instance.pending_deletion and not instance.deleted:
- if not utils.enqueue_task(
- '/internal/queues/check-deleted-instance',
- 'check-deleted-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning('Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('check-deleted-instance', instance.key)
@ndb.transactional
@@ -273,14 +266,7 @@ def schedule_deleted_instance_cleanup():
for instance in models.Instance.query():
if instance.deleted and (now - instance.last_updated).seconds > THRESHOLD:
- if not utils.enqueue_task(
- '/internal/queues/cleanup-deleted-instance',
- 'cleanup-deleted-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning('Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('cleanup-deleted-instance', instance.key)
def cleanup_drained_instance(key):
@@ -340,12 +326,4 @@ def schedule_drained_instance_cleanup():
for instance_key in instance_group_manager.instances:
instance = instance_key.get()
if instance and not instance.cataloged:
- if not utils.enqueue_task(
- '/internal/queues/cleanup-drained-instance',
- 'cleanup-drained-instance',
- params={
- 'key': instance.key.urlsafe(),
- },
- ):
- logging.warning(
- 'Failed to enqueue task for Instance: %s', instance.key)
+ utilities.enqueue_task('cleanup-drained-instance', instance.key)
« no previous file with comments | « appengine/gce-backend/catalog.py ('k') | appengine/gce-backend/instance_group_managers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698