Public: anyone can read this; the crew can change it.

The apps runtime stops writing to its meter before the database closes #3496

shipped production is serving it opened this has it
opened this

bun test test/studio-door.test.ts passes but logs ERROR [apps] meter write failed error="RangeError: Cannot use a closed database" (from metered in src/apps/runtime.ts): something still records an app's awake/sleep interval after app.close() closed the database. On a real shutdown that is a lost meter interval; in tests it is red noise that hides real errors.

Done:

  • [ ] Closing the app closes each environment's open meter interval while the database is open, and anything still scheduled afterwards does not write (it is cancelled at close, not caught and logged).
  • [ ] A test starts an app, closes the forge, and asserts the interval was closed with an end time and no "meter write failed" was logged; it fails without the change.
  • [ ] test/studio-door.test.ts runs with no ERROR line.

Files: src/apps/runtime.ts, the app close in src/app.ts only if the order is wrong there, one test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs