Nightshift Background Jobs
The shared background worker that processes Metadata Expansion and Document Summarization jobs.
Nightshift is the background worker behind Metadata Expansion and Document Summarization. It runs as a process separate from DeepFellow Server, so an API restart or crash does not kill an in-flight job.
Enable Nightshift
Nightshift is disabled by default. With it disabled, Metadata Expansion and Document Summarization still work: each job dispatches its documents in-process instead, one at a time, with no retry across API restarts. See Dispatch without Nightshift for what changes when Nightshift is off.
To enable Nightshift:
- Run a RabbitMQ instance reachable from your server, and set
DF_RABBITMQ_URLto its connection string. - Set
DF_NIGHTSHIFT_ENABLED=true. - Run the Nightshift worker process alongside your server.
DF_NIGHTSHIFT_ENABLED, DF_RABBITMQ_URL, and DF_RABBITMQ_CONNECT_TIMEOUT_SECONDS are bootstrap settings: the server reads them from .env at startup only, and changing one requires a restart. See Bootstrap Settings vs. Dynamic Settings.
| Setting | Description | Default |
|---|---|---|
DF_NIGHTSHIFT_ENABLED | Enables RabbitMQ-backed dispatch for Metadata Expansion and Document Summarization jobs. | false |
DF_RABBITMQ_URL | Connection string for the RabbitMQ instance. | amqp://guest:guest@localhost:5672/ |
DF_RABBITMQ_CONNECT_TIMEOUT_SECONDS | How long the server waits for the initial RabbitMQ connection at startup before giving up and continuing without it. | 10 |
If the server cannot connect to RabbitMQ at startup while DF_NIGHTSHIFT_ENABLED is true, it logs the failure and continues running. Every route except job creation for Metadata Expansion and Document Summarization keeps working normally.
Dispatch without Nightshift
With DF_NIGHTSHIFT_ENABLED set to false, POST /v1/metadata/expand and POST /v1/summarization/summarize still create a job and process its documents, but through a different path:
- Each document runs as an in-process background task instead of a RabbitMQ message.
- A document gets a single attempt instead of the broker-driven retry with backoff described in Retry Behavior. If a document fails, mark it for another attempt by calling the job's
retryendpoint. - An API restart while a job is running leaves any pending documents in that job stuck. Call the job's
retryendpoint after the restart to resume them.
Pausing, resuming, and retrying a job work the same way regardless of whether Nightshift is enabled. See Metadata Expansion and Document Summarization for their job endpoints.
Retry Behavior
With Nightshift enabled, a document that fails while processing is redelivered with exponential backoff: 5 seconds, then 10, then 20, doubling up to a cap of 5 minutes between attempts. A document that keeps failing is marked failed once it reaches the job type's configured attempt limit (metadata_expansion_max_attempts or summarization_max_attempts, both dynamic settings; see below). A malformed message is dropped immediately, since redelivering it can never make it valid.
Configuration
The following are dynamic settings: change them with the Server Configuration card or the /admin/config API, without a restart. See Bootstrap Settings vs. Dynamic Settings.
| Setting | Description | Default |
|---|---|---|
nightshift_jobs_timeout_seconds | Maximum time a single document's extraction or summarization step may run before it is treated as a failed attempt. Shared by both job types. | 1800 |
metadata_expansion_max_attempts | Attempts a Metadata Expansion document gets before it is marked failed. | 3 |
summarization_max_attempts | Attempts a Document Summarization document gets before it is marked failed. | 3 |
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.