From 1853270d25ba6cceed559ccad7c7c328ade3477c Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Thu, 15 Oct 2020 10:03:09 -0400 Subject: [PATCH] stop automatically queueing objects for work --- src/api-service/__app__/onefuzzlib/orm.py | 19 ------------------- .../__init__.py | 0 .../function.json | 0 .../__init__.py | 0 .../function.json | 0 .../__init__.py | 0 .../function.json | 0 .../{daily_events => timer_daily}/__init__.py | 0 .../function.json | 0 .../__init__.py | 0 .../function.json | 0 .../__init__.py | 0 .../function.json | 0 .../__init__.py | 0 .../function.json | 0 .../__init__.py | 0 .../function.json | 0 17 files changed, 19 deletions(-) rename src/api-service/__app__/{events => queue_file_changes}/__init__.py (100%) rename src/api-service/__app__/{events => queue_file_changes}/function.json (100%) rename src/api-service/__app__/{heartbeat => queue_heartbeat}/__init__.py (100%) rename src/api-service/__app__/{heartbeat => queue_heartbeat}/function.json (100%) rename src/api-service/__app__/{update_queue => queue_updates}/__init__.py (100%) rename src/api-service/__app__/{update_queue => queue_updates}/function.json (100%) rename src/api-service/__app__/{daily_events => timer_daily}/__init__.py (100%) rename src/api-service/__app__/{daily_events => timer_daily}/function.json (100%) rename src/api-service/__app__/{scheduled_events => timer_events}/__init__.py (100%) rename src/api-service/__app__/{scheduled_events => timer_events}/function.json (100%) rename src/api-service/__app__/{pool_resize => timer_pool_resize}/__init__.py (100%) rename src/api-service/__app__/{pool_resize => timer_pool_resize}/function.json (100%) rename src/api-service/__app__/{scaleset_events => timer_scalesets}/__init__.py (100%) rename src/api-service/__app__/{scaleset_events => timer_scalesets}/function.json (100%) rename src/api-service/__app__/{schedule_tasks => timer_schedule_tasks}/__init__.py (100%) rename src/api-service/__app__/{schedule_tasks => timer_schedule_tasks}/function.json (100%) diff --git a/src/api-service/__app__/onefuzzlib/orm.py b/src/api-service/__app__/onefuzzlib/orm.py index 0dd77eed98..d0c0b9ae89 100644 --- a/src/api-service/__app__/onefuzzlib/orm.py +++ b/src/api-service/__app__/onefuzzlib/orm.py @@ -63,8 +63,6 @@ SAFE_STRINGS = (UUID, Container, Region, PoolName) KEY = Union[int, str, UUID, Enum] -QUEUE_DELAY_STOPPING_SECONDS = 30 -QUEUE_DELAY_CREATE_SECONDS = 5 HOURS = 60 * 60 @@ -228,22 +226,6 @@ def event(self) -> Any: def telemetry(self) -> Any: return self.raw(exclude_none=True, include=self.telemetry_include()) - def _queue_as_needed(self) -> None: - # Upon ORM save with state, if the object has a state that needs work, - # automatically queue it - state = getattr(self, "state", None) - if state is None: - return - needs_work = getattr(state, "needs_work", None) - if needs_work is None: - return - if state not in needs_work(): - return - if state.name in ["stopping", "stop", "shutdown"]: - self.queue(visibility_timeout=QUEUE_DELAY_STOPPING_SECONDS) - else: - self.queue(visibility_timeout=QUEUE_DELAY_CREATE_SECONDS) - def _event_as_needed(self) -> None: # Upon ORM save, if the object returns event data, we'll send it to the # dashboard event subsystem @@ -306,7 +288,6 @@ def save(self, new: bool = False, require_etag: bool = False) -> Optional[Error] else: self.etag = client.insert_or_replace_entity(self.table_name(), raw) - self._queue_as_needed() if self.table_name() in TelemetryEvent.__members__: telem = self.telemetry() if telem: diff --git a/src/api-service/__app__/events/__init__.py b/src/api-service/__app__/queue_file_changes/__init__.py similarity index 100% rename from src/api-service/__app__/events/__init__.py rename to src/api-service/__app__/queue_file_changes/__init__.py diff --git a/src/api-service/__app__/events/function.json b/src/api-service/__app__/queue_file_changes/function.json similarity index 100% rename from src/api-service/__app__/events/function.json rename to src/api-service/__app__/queue_file_changes/function.json diff --git a/src/api-service/__app__/heartbeat/__init__.py b/src/api-service/__app__/queue_heartbeat/__init__.py similarity index 100% rename from src/api-service/__app__/heartbeat/__init__.py rename to src/api-service/__app__/queue_heartbeat/__init__.py diff --git a/src/api-service/__app__/heartbeat/function.json b/src/api-service/__app__/queue_heartbeat/function.json similarity index 100% rename from src/api-service/__app__/heartbeat/function.json rename to src/api-service/__app__/queue_heartbeat/function.json diff --git a/src/api-service/__app__/update_queue/__init__.py b/src/api-service/__app__/queue_updates/__init__.py similarity index 100% rename from src/api-service/__app__/update_queue/__init__.py rename to src/api-service/__app__/queue_updates/__init__.py diff --git a/src/api-service/__app__/update_queue/function.json b/src/api-service/__app__/queue_updates/function.json similarity index 100% rename from src/api-service/__app__/update_queue/function.json rename to src/api-service/__app__/queue_updates/function.json diff --git a/src/api-service/__app__/daily_events/__init__.py b/src/api-service/__app__/timer_daily/__init__.py similarity index 100% rename from src/api-service/__app__/daily_events/__init__.py rename to src/api-service/__app__/timer_daily/__init__.py diff --git a/src/api-service/__app__/daily_events/function.json b/src/api-service/__app__/timer_daily/function.json similarity index 100% rename from src/api-service/__app__/daily_events/function.json rename to src/api-service/__app__/timer_daily/function.json diff --git a/src/api-service/__app__/scheduled_events/__init__.py b/src/api-service/__app__/timer_events/__init__.py similarity index 100% rename from src/api-service/__app__/scheduled_events/__init__.py rename to src/api-service/__app__/timer_events/__init__.py diff --git a/src/api-service/__app__/scheduled_events/function.json b/src/api-service/__app__/timer_events/function.json similarity index 100% rename from src/api-service/__app__/scheduled_events/function.json rename to src/api-service/__app__/timer_events/function.json diff --git a/src/api-service/__app__/pool_resize/__init__.py b/src/api-service/__app__/timer_pool_resize/__init__.py similarity index 100% rename from src/api-service/__app__/pool_resize/__init__.py rename to src/api-service/__app__/timer_pool_resize/__init__.py diff --git a/src/api-service/__app__/pool_resize/function.json b/src/api-service/__app__/timer_pool_resize/function.json similarity index 100% rename from src/api-service/__app__/pool_resize/function.json rename to src/api-service/__app__/timer_pool_resize/function.json diff --git a/src/api-service/__app__/scaleset_events/__init__.py b/src/api-service/__app__/timer_scalesets/__init__.py similarity index 100% rename from src/api-service/__app__/scaleset_events/__init__.py rename to src/api-service/__app__/timer_scalesets/__init__.py diff --git a/src/api-service/__app__/scaleset_events/function.json b/src/api-service/__app__/timer_scalesets/function.json similarity index 100% rename from src/api-service/__app__/scaleset_events/function.json rename to src/api-service/__app__/timer_scalesets/function.json diff --git a/src/api-service/__app__/schedule_tasks/__init__.py b/src/api-service/__app__/timer_schedule_tasks/__init__.py similarity index 100% rename from src/api-service/__app__/schedule_tasks/__init__.py rename to src/api-service/__app__/timer_schedule_tasks/__init__.py diff --git a/src/api-service/__app__/schedule_tasks/function.json b/src/api-service/__app__/timer_schedule_tasks/function.json similarity index 100% rename from src/api-service/__app__/schedule_tasks/function.json rename to src/api-service/__app__/timer_schedule_tasks/function.json