Island: Add check that terminate timestamp is > 0 in AgentSignals resource

This commit is contained in:
Shreya Malviya 2022-09-23 17:18:16 +05:30 committed by Mike Salvatore
parent 1632d8b3e9
commit 24210d4f6f
1 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,8 @@ class AgentSignals(AbstractResource):
terminate_timestamp = request.json["terminate_time"]
if terminate_timestamp is None:
raise ValueError("Terminate signal's timestamp is empty")
elif terminate_timestamp <= 0:
raise ValueError("Terminate signal's timestamp is not a positive integer")
self._island_event_queue.publish(
IslandEventTopic.TERMINATE_AGENTS, timestamp=terminate_timestamp