Skip to main content

import_djot_sync

Function import_djot_sync 

Source
pub fn import_djot_sync(
    db_context: &DbContext,
    event_hub: &Arc<EventHub>,
    dto: &ImportDjotDto,
) -> Result<ImportDjotResultDto>
Expand description

Import Djot synchronously, on the calling thread.

import_djot hands the use case to the LongOperationManager, which spawns a thread for it. That is right for a UI import (it must not block the frame loop), and wrong for a batch caller — a backend that has to parse and rewrite hundreds of documents in one operation would spawn hundreds of threads to do work it wants to do inline anyway.

The use case itself is thread-agnostic: it only needs a progress sink and a cancel flag. So this hands it a no-op sink and a never-set flag and calls it directly. No thread, no operation id, no polling — the result is simply returned.

(Cancellation is the caller’s business here: a synchronous caller can just stop calling. The flag exists to satisfy the LongOperation signature, not to be used.)