Skip to content

Workers-specific constraints ​

Upstream Misskey is designed around a long-running Node.js process. That assumption does not hold on Cloudflare Workers, so the design changes to fit the constraints below.

Execution model ​

ConstraintEffectApproach
No long-running process; many execution environments (isolates) run side by side and can be discarded at any timeIn-memory state cannot be shared or keptState that must be shared lives in Durable Objects, KV, or PostgreSQL
No pub/sub between processesCaches cannot be invalidated immediatelyRarely changing data (meta, roles) is kept with a short lifetime. Other execution environments see changes up to 30 seconds later
Accumulating deltas in memory and flushing them periodically does not workUpstream's chart recording cannot be usedCharts are computed from the source data on request. IDs carry the creation time, so no extra recording is needed. Decrements and event-based series cannot be recorded
CPU time and subrequests per invocation are cappedLarge jobs cannot run in one goAccount deletion, imports, account migration and similar jobs are split into small steps, each re-enqueuing the next
128 MB of memoryLarge files and outputs cannot be handled at onceThe upload limit defaults to 100 MB. Exports of extremely large accounts can hit the limit
Machine information (CPU, memory, disk) is unavailableServer info cannot be reportedSame shape as upstream, with fixed values

Asynchronous processing ​

ConstraintEffectApproach
Queue delays are at most 12 hoursLong delayed jobs cannot be scheduled in one messageScheduled notes and poll endings run on Durable Object alarms. The 24-hour wait in account migration is split into several waits
A Worker cannot list or delete Queue messagesUpstream's job admin UI cannot be reproducedFailed and delayed jobs are recorded in a Durable Object and shown within that range. Waiting jobs cannot be shown or deleted

Network and external services ​

ConstraintEffectApproach
The peer IP address is not visible and DNS cannot be queriedSSRF cannot be checked on the resolved addressHosts are checked by name, on every redirect
No SMTP (TCP) sendingUpstream's mail settings cannot be usedMail goes through Cloudflare Email Service (requires the Workers Paid plan)
The request body limit depends on the zone's plan (100 MB on Free / Pro)The upload limit cannot exceed the planThe default limit matches the plan. Upstream clients upload in a single request, so chunked uploads are not adopted
Native modules (sharp, ffmpeg) cannot run in a WorkerImages and videos cannot be convertedThey run in Containers. Uploads succeed even when the Container is down; only thumbnails are missing
A machine-learning model would make the Container much larger and heavierAutomatic sensitive-media detection is not possibleNot supported (the settings are stored but have no effect)

Database ​

ConstraintEffectApproach
Workers reach PostgreSQL through HyperdriveConnections are costlyOne connection serves a whole request. The Workers run close to the database (Smart Placement)
Hyperdrive's SELECT cache is not invalidated by writesReads right after writes can be staleThe cache is disabled
Cloudflare D1 is SQLiteAn existing Misskey database could not be carried overNot used. Durable Object SQLite is used only for the Durable Objects' own state

Deployment ​

ConstraintEffectApproach
Binding another Worker's Durable Object requires the owning Worker to be deployed firstDeploy order has dependenciesReferences point one way only; deploy in the order stream, timeline, media, api, gateway
Workers are also published on a workers.dev subdomain by defaultEntrances that differ from the instance URL, or bypass the gateway, appearOnly the gateway's custom domain is public; the other Workers' public URLs are disabled