Skip to content

Commit

Permalink
#602 fixed a bug that fast scripts were notified about finish before …
Browse files Browse the repository at this point in the history
…start
  • Loading branch information
bugy committed Jul 27, 2023
1 parent d519350 commit 179f18c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/execution/execution_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def start_script(self, config, user: User):
config=config)
self._active_executor_ids.add(execution_id)

self._add_post_finish_handling(execution_id, executor, user)

self._fire_execution_started(execution_id, user)

self._add_post_finish_handling(execution_id, executor, user)

return execution_id

def stop_script(self, execution_id, user):
Expand Down
14 changes: 14 additions & 0 deletions src/tests/execution_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ def test_finish_listener_by_id(self):
self.get_process(id1).stop()
self.assertEqual(1, len(notifications))

def test_start_finish_listener_order(self):
executor._process_creator = create_process_wrapper

execution_service = self.create_execution_service()

notifications = []

execution_service.add_finish_listener(lambda _, __: notifications.append('finished'))
execution_service.add_start_listener(lambda _, __: notifications.append('started'))

self._start(execution_service)

self.assertEqual(['started', 'finished'], notifications)

def _start(self, execution_service, user_id=DEFAULT_USER_ID):
return _start(execution_service, user_id)

Expand Down

0 comments on commit 179f18c

Please sign in to comment.