Skip to content

Commit a23d5ff

Browse files
committed
Add delay between calling C-STORE and updating worklist item status
There's a possible race condition where the C-STORE command updates the worklist item to IN PROGRESS after we attempt to move it to COMPLETED.
1 parent b9ad112 commit a23d5ff

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/modality_emulator.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ def process_worklist_items(self, ae: AE):
154154
)
155155
series_number += 1
156156

157-
self.mwl_storage.update_status(accession_number, MWLStatus.COMPLETED.value)
158-
logger.info(f"Completed processing for worklist item {accession_number}")
157+
time.sleep(2) # Allow C-STORE operations to complete before updating status
158+
159+
updated = self.mwl_storage.update_status(accession_number, MWLStatus.COMPLETED.value)
160+
if not updated:
161+
logger.error(f"Failed to update status for worklist item {accession_number}")
162+
else:
163+
logger.info(f"Completed processing for worklist item {accession_number}")
159164
elif status_code == SUCCESS:
160165
logger.info("C-FIND query completed successfully")
161166
else:

0 commit comments

Comments
 (0)