workerd has no cron triggers, but it runs Durable Object alarms, and the cache DOs already hold their wiring to the webapp: a refresh scheduled from inside the DO needs no credential outside it (a systemd timer would need a cache id to call /api with). A fill that ends (done or failed) sets an alarm 3 hours out; it starts a fill that refetches every page through the deepest one holding an item updated in the last 2 days (page 1 at least, where new bookmarks land). Refetching overwrites pages in place rather than dropping them first, so a refresh that fails leaves the cache as it was. stopFill now also stops a finished job's refreshes. FillStatus gains refetchThrough (optional; additive). Caches whose fill ended before this get their first refresh alarm when they next wake. The service starts at boot as well as on the socket: alarms fire only while workerd runs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
32 lines
1.1 KiB
Desktop File
32 lines
1.1 KiB
Desktop File
[Unit]
|
|
Description=diigo-cache and webapp (workerd)
|
|
Requires=diigo-cache.socket
|
|
|
|
[Service]
|
|
# the profile path survives upgrades; see doc/install.md
|
|
ExecStart=/nix/var/nix/profiles/diigo-cache/bin/diigo-cache-serve -S http=3 -d cache-state=/var/lib/diigo-cache/cache -d webapp-state=/var/lib/diigo-cache/webapp
|
|
DynamicUser=yes
|
|
StateDirectory=diigo-cache diigo-cache/cache diigo-cache/webapp
|
|
StateDirectoryMode=0700
|
|
# webapp fetches diigo.com; nothing else needs the network
|
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
|
ProtectSystem=strict
|
|
ProtectHome=yes
|
|
PrivateTmp=yes
|
|
PrivateDevices=yes
|
|
ProtectKernelTunables=yes
|
|
ProtectKernelModules=yes
|
|
ProtectControlGroups=yes
|
|
RestrictNamespaces=yes
|
|
LockPersonality=yes
|
|
CapabilityBoundingSet=
|
|
SystemCallFilter=@system-service
|
|
# V8 uses memory protection keys; without these, SIGSYS at startup
|
|
SystemCallFilter=pkey_alloc pkey_mprotect pkey_free
|
|
# not MemoryDenyWriteExecute: V8's JIT needs W+X
|
|
|
|
[Install]
|
|
# started at boot, not only on the first request: workerd runs the
|
|
# caches' refresh alarms only while it is up
|
|
WantedBy=multi-user.target
|