Interstitial page locking fix (#228)
Tested on dev.app by @burnettk @jasquat @calexh-sar
This commit is contained in:
parent
7fb5c82bbc
commit
17b01444a9
|
@ -383,8 +383,7 @@ def _render_instructions_for_end_user(task_model: TaskModel, extensions: Optiona
|
|||
return ""
|
||||
|
||||
|
||||
def _interstitial_stream(process_instance_id: int) -> Generator[str, Optional[str], None]:
|
||||
process_instance = _find_process_instance_by_id_or_raise(process_instance_id)
|
||||
def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[str, Optional[str], None]:
|
||||
processor = ProcessInstanceProcessor(process_instance)
|
||||
reported_ids = [] # bit of an issue with end tasks showing as getting completed twice.
|
||||
spiff_task = processor.next_task()
|
||||
|
@ -427,10 +426,15 @@ def _interstitial_stream(process_instance_id: int) -> Generator[str, Optional[st
|
|||
yield f"data: {current_app.json.dumps(task)} \n\n"
|
||||
|
||||
|
||||
def _dequeued_interstitial_stream(process_instance_id: int) -> Generator[str, Optional[str], None]:
|
||||
process_instance = _find_process_instance_by_id_or_raise(process_instance_id)
|
||||
with ProcessInstanceQueueService.dequeued(process_instance):
|
||||
yield from _interstitial_stream(process_instance)
|
||||
|
||||
def interstitial(process_instance_id: int) -> Response:
|
||||
"""A Server Side Events Stream for watching the execution of engine tasks."""
|
||||
return Response(
|
||||
stream_with_context(_interstitial_stream(process_instance_id)),
|
||||
stream_with_context(_dequeued_interstitial_stream(process_instance_id)),
|
||||
mimetype="text/event-stream",
|
||||
headers={"X-Accel-Buffering": "no"},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue