Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

stop automatically queueing objects for work #159

Merged
merged 3 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/api-service/__app__/onefuzzlib/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down