Skip to main content

Heartbeat Worker

A simple test worker used to verify that the worker system is functioning correctly.

Included in Base Preset

Registered automatically by registerBasePlugins() / registerAllPlugins().

Registration​

import { pluginRegistry } from '@unchainedshop/core';
import { HeartbeatPlugin } from '@unchainedshop/plugins/worker/heartbeat';

pluginRegistry.register(HeartbeatPlugin);

Purpose​

The Heartbeat Worker is primarily used for:

  • Testing that the worker queue is processing jobs
  • Debugging worker system issues
  • Health checks in monitoring systems
  • Simulating work delays for testing

Usage​

Create a heartbeat work item:

mutation TestWorker {
addWork(
type: HEARTBEAT
input: {
wait: 1000
fails: false
}
) {
_id
status
}
}

Note: wait is milliseconds to wait before completing, fails: true simulates a failure.

Input Parameters​

ParameterTypeDefaultDescription
waitNumber-Milliseconds to wait before completing
failsBooleanfalseIf true, the work will fail instead of succeed

Adapter Details​

PropertyValue
Keyshop.unchained.worker-plugin.heartbeat
TypeHEARTBEAT
Max Parallel1
Sourceworker/heartbeat