Repository navigation
fix(worker): scan watched folders and run routines from lens worker - #42
Merged
Merged
Conversation
Docker, Synology, QNAP, Cloudron and Proxmox all run the API with RUN_BACKGROUND=false and a separate lens worker, but only the API's background work polled watched folders and ran routines, so neither ever happened there. lens worker now starts both (unless limited with --steps or --no-schedule). Folder scans are claimed before they run. Also makes the watch preview test hold where LibreOffice is installed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ja26f8Npk3M6ixFhE1WEfe
Owner
Author
|
Every check here fails within about 3 seconds and leaves no logs. The same happens on every push to I ran the CI steps locally on this head instead, and all of them passed:
I also checked it in the dev Docker stack, where the watched folder now gets scanned. Merging on that basis, under the project's merge policy. Generated by Claude Code |
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: in
make dev,make runand every package (Synology, QNAP, Cloudron, Proxmox), a watched folder showed "Last scan never" forever, and routines never ran on their schedule.After: the worker scans watched folders and runs routines when they are due, so new files come in and scheduled routines run.
Motivation and Context
Found while testing main end to end in Docker. Every Docker and package setup runs the API with
RUN_BACKGROUND=falseand a separatelens worker. But only the API's background work polled watched folders and ran routines.lens workeronly ran jobs and sent notifications, and nothing ranlens watch.How: the two scheduling threads move into
routines.start(). The API's background work andlens workerboth call it. A worker limited with--steps(a Mac mlx worker) doesn't run them, and neither does one started with--no-schedule.sources.poll_duenow claims a folder scan before it starts, as routine runs already are, so two processes never scan the same folder at once.Also fixes
test_watch_preview_counts_files, which failed wherever LibreOffice is installed. A.txtfile counts as a document there. CI skips this test because it has no rclone.Steps to reproduce (if appropriate):
make dev, finish the setup wizard with a watched folder, then open Sources. Before this change it shows "Last scan never" indefinitely.Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md.Validated locally because GitHub Actions jobs on this repo currently fail within seconds, with no logs. I ran ruff, ruff format, mypy, the OpenAPI diff, and
test_sourcesplustest_routines(with rclone) on both embedded SurrealDB and a SurrealDB 3.2.4 server.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ja26f8Npk3M6ixFhE1WEfe
Generated by Claude Code