@volter/teams 0.1.54 → 0.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/core.mjs +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/teams",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "type": "module",
5
5
  "description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
6
6
  "license": "MIT",
package/server/core.mjs CHANGED
@@ -59,7 +59,6 @@ export async function bootstrapServer(api,{initTeam,bootstrap}){
59
59
 
60
60
  /** Expire cursors, idempotency records, staged captures and uploads, and old journal rows. */
61
61
  export async function maintain(api){const now=api.clock.nowMs();
62
- await reconcileMachinePresence(api);
63
62
  // Replay records expire after a day; keeping them forever can fill the object and stop heartbeats.
64
63
  // Delete them before any retention step that may update a surviving version.
65
64
  const expired=await api.store.query('SELECT rowid FROM idempotency WHERE expires_at<=? LIMIT 1000',[now]);
@@ -106,6 +105,9 @@ export async function maintain(api){const now=api.clock.nowMs();
106
105
  {sql:'INSERT OR IGNORE INTO capture_expiries(team_id,source_id,id,expired_at) SELECT team_id,source_id,id,? FROM uploads WHERE committed=0 AND created_at+86400000<=?',params:[now,now]},
107
106
  {sql:'DELETE FROM uploads WHERE committed=0 AND created_at+86400000<=?',params:[now]},
108
107
  ]).catch(()=>{});
108
+ // Presence reconciliation can INSERT. Never put it ahead of the deletes
109
+ // that make room when the database is full.
110
+ await reconcileMachinePresence(api);
109
111
  const result={pruned_versions:stale.length,pruned_parts:parts.length,pruned_idempotency:expired.length,pruned_uploads:orphaned.length,backlog:orphaned.length>=10||expired.length>=1000||stale.length>=VERSION_PRUNE_BATCH||parts.length>=PART_PRUNE_BATCH};
110
112
  if(result.pruned_versions||result.pruned_parts||result.pruned_idempotency||result.pruned_uploads)console.log(`maintain: pruned ${result.pruned_uploads} unreachable bundles, ${result.pruned_idempotency} expired replay records, ${result.pruned_parts} parts, ${result.pruned_versions} versions${result.backlog?' (backlog)':''}`);
111
113
  return result;}