Skip to content

Commit 5aa6463

Browse files
committed
Update to handle @scan(ONCE) explicitly
1 parent aedd262 commit 5aa6463

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/fastcs/controller_api.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,23 @@ def get_scan_and_initial_coros(
4949
initial_coros: list[Callable] = []
5050

5151
for controller_api in self.walk_api():
52-
_add_scan_method_tasks(scan_dict, controller_api)
52+
_add_scan_method_tasks(scan_dict, initial_coros, controller_api)
5353
_add_attribute_update_tasks(scan_dict, initial_coros, controller_api)
5454

5555
scan_coros = _get_periodic_scan_coros(scan_dict)
5656
return scan_coros, initial_coros
5757

5858

5959
def _add_scan_method_tasks(
60-
scan_dict: dict[float, list[Callable]], controller_api: ControllerAPI
60+
scan_dict: dict[float, list[Callable]],
61+
initial_coros: list[Callable],
62+
controller_api: ControllerAPI,
6163
):
6264
for method in controller_api.scan_methods.values():
63-
scan_dict[method.period].append(method.fn)
65+
if method.period is ONCE:
66+
initial_coros.append(method.fn)
67+
else:
68+
scan_dict[method.period].append(method.fn)
6469

6570

6671
def _add_attribute_update_tasks(

0 commit comments

Comments
 (0)