Skip to content

fix: dispatch periodic BookStack indexing from the scheduler task_map#1570

Open
pelazas wants to merge 1 commit into
MODSetter:devfrom
pelazas:fix/scheduler-task-map-bookstack
Open

fix: dispatch periodic BookStack indexing from the scheduler task_map#1570
pelazas wants to merge 1 commit into
MODSetter:devfrom
pelazas:fix/scheduler-task-map-bookstack

Conversation

@pelazas

@pelazas pelazas commented Jul 4, 2026

Copy link
Copy Markdown

BookStack connectors with periodic sync enabled never actually sync — BOOKSTACK_CONNECTOR isn't in the scheduler's task_map, so the sync silently no-ops.

Description

The BookStack connect form lets you turn on periodic sync, but check_periodic_schedules has no task_map entry for BOOKSTACK_CONNECTOR. A due connector falls into the warning branch:

logger.warning(
    f"No task found for connector type {connector.connector_type}"
)

That branch also never advances next_scheduled_at, so the connector stays "due" forever and logs this warning every minute.

The fix is two lines: import index_bookstack_pages_task and add it to task_map. It takes (connector_id, search_space_id, user_id, start_date, end_date) like the other generically-dispatched tasks (Notion/Confluence/GitHub), so no special handling needed.

One note: #891 also mentions Obsidian, but I left that out on purpose — Obsidian moved to push-based indexing via the plugin routes (index_obsidian_attachment_task), there's no vault-pull task to schedule anymore.

Motivation and Context

Enabling periodic sync on BookStack does nothing right now, and the only symptom is a log warning every minute. There was an earlier fix attempt (#893) but it was closed for targeting main and never re-raised on dev.

FIX #891

Screenshots

N/A — backend scheduler change.

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Added unit tests in tests/unit/tasks/celery_tasks/test_schedule_checker_task.py that run _check_and_trigger_schedules with the DB session, Redis lock and Celery .delay mocked:

  • a due BookStack connector dispatches index_bookstack_pages_task and gets next_scheduled_at advanced — this fails on dev (reproduces the exact "No task found" warning) and passes with the fix
  • an unmapped connector type still dispatches nothing

Run with cd surfsense_backend && uv run pytest tests/unit/tasks/celery_tasks/test_schedule_checker_task.py. Full unit suite passes (2380 tests), pre-commit hooks clean.

I didn't test against a live BookStack instance, but the dispatched task is the same one the manual "index now" route already uses.

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

BOOKSTACK_CONNECTOR was missing from check_periodic_schedules' task_map,
so connectors with periodic indexing enabled fell through to the
"No task found" warning branch every minute and never synced.

Fixes MODSetter#891

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

@pelazas is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ec8fa1da-4fae-421e-a85d-373b3c89f21c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant