Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cosmasense.tech/llms.txt

Use this file to discover all available pages before exploring further.

The scheduler monitors system conditions (battery, CPU, temperature, time) and automatically pauses or resumes the indexing queue based on configurable rules.

Get Scheduler Config

GET /api/queue/scheduler
cURL
curl http://localhost:60534/api/queue/scheduler

Response

enabled
boolean
Whether the scheduler is active
combine_mode
string
How rules are combined: "ALL" (every rule must pass) or "ANY" (at least one must pass)
check_interval_seconds
number
How often the scheduler checks conditions (in seconds)
rules
array
List of scheduler rules
conditions_met
boolean
Whether the current system conditions satisfy all rules
200 Success
{
  "enabled": true,
  "combine_mode": "ALL",
  "check_interval_seconds": 30,
  "rules": [
    {
      "rule": "battery_level",
      "operator": ">=",
      "value": 20,
      "enabled": true
    },
    {
      "rule": "power_source",
      "operator": "==",
      "value": true,
      "enabled": true
    }
  ],
  "conditions_met": true
}

Update Scheduler Config

PUT /api/queue/scheduler Update scheduler configuration. All fields are optional; only provided fields are updated.
cURL
curl -X PUT http://localhost:60534/api/queue/scheduler \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "combine_mode": "ALL",
    "check_interval_seconds": 60,
    "rules": [
      {"rule": "battery_level", "operator": ">=", "value": 30, "enabled": true},
      {"rule": "cpu_percent", "operator": "<=", "value": 80, "enabled": true}
    ]
  }'

Available Rule Types

RuleDescriptionOperatorsValue Type
battery_levelBattery percentage (0-100)>=, <=, >, <, ==number
power_sourceWhether plugged in==boolean
cpu_idleSeconds since CPU was idle>=number
cpu_percentCurrent CPU usage percentage<=, >=number
cpu_temperatureCPU temperature in Celsius<=number
fan_speedFan speed in RPM<=number
time_windowTime-of-day windowinstring ("HH:MM-HH:MM")

Combine Modes

  • ALL: All enabled rules must pass for the queue to run (AND logic)
  • ANY: At least one enabled rule must pass (OR logic)