Explorer

html-ui.deploy

description
(en) Deploys html-ui to the Cloudflare Worker definy-html, a mirror of the public server with its own D1 database definy-html. Its Cron trigger receives from the public server every minute, a little per run (at most 5 events and 50 contents), then caches at most 2 snapshots (definy.warm-snapshot-cache) to stay within the CPU time limit of the Workers Free plan. Set the value on the page of definy.cloudflare-api-token first (Workers Scripts and D1 edit permissions)
type
@wasi.io
expression
@definy.deploy-service-worker(
  worker_name: "definy-html",
  database_name: "definy-html",
  cron: "* * * * *",
  api_token: @definy.cloudflare-api-token,
  handler: quote({
    fetch: fn(request$0) =>
      @html-ui.handle(editable: false, request: $0),
    scheduled: fn(time_ms$1) =>
      @definy.service-io-then-respond(
        io: @definy.mirror-receive(remote: "https://definy.narumincho.com", limit: 5, content_limit: 50),
        respond: fn(response$2) =>
          @definy.warm-snapshot-cache(
            limit: 2,
            then: fn(count$3) =>
              #done<@definy.service-io>(#respond($2))
          )
      )
  })
)
visibility
public
html-ui.deploy (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: 8ZILUFDoKw9Yh2NNuQ8q9XFXo75f-v044uIEiOfr7PM
content hash: iFrhMPDrRJ1WDnN0R0oKVoJvzMQVvZpJpJSOzNPI5ss