Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 10m21s
Docker images / frontend-image (push) Successful in 2m8s
Docker images / updater-image (push) Successful in 38s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / backend-image (push) Successful in 1m59s
Docker images / publish-release (push) Successful in 12s
Docker images / notify-webhook (push) Successful in 2s
32 lines
2.6 KiB
TypeScript
32 lines
2.6 KiB
TypeScript
import assert from "node:assert/strict"
|
|
import { randomUUID } from "node:crypto"
|
|
import { mkdir, writeFile } from "node:fs/promises"
|
|
import { resolve } from "node:path"
|
|
/** Owned normal/historical SQL profiles only; acceptance across the former quotas. */
|
|
export async function acceptPollStorageScaleSql(){
|
|
assert([process.env.MMAPP_OWN_SERVER_POLL_STORAGE,process.env.MMAPP_OWN_SERVER_POLL_STORAGE_FRESH].includes("true"))
|
|
const {pool}=await import("../db/index.js")
|
|
const {createServerPollStorage}=await import("./server-poll-storage.js")
|
|
const globalBefore=Number((await pool.query("SELECT admissions FROM server_poll_storage_usage WHERE scope='global'")).rows[0].admissions)
|
|
const ownerId="owned-fill-"+randomUUID()
|
|
const claim = async () => {
|
|
const scope={receiptId:randomUUID(),kind:"rest" as const,executionId:randomUUID(),ownerId,bindingProof:"a".repeat(64),contextProof:"b".repeat(64),issuedAt:Date.now()-1000,expiresAt:Date.now()+180000}
|
|
return createServerPollStorage({scope,connectionId:null,maxStages:8,authorize:async()=>{}}).claim({deadlineAt:Date.now()+60000},async sql=>{
|
|
await sql.query("INSERT INTO server_poll_executions(receipt_id,identity_kind,execution_id,binding_proof,context_ciphertext,context_proof) VALUES($1,'rest',$2,$3,'SYNTHETIC',$4)",[scope.receiptId,scope.executionId,scope.bindingProof,scope.contextProof])
|
|
})
|
|
}
|
|
const additional = 130
|
|
for (let index = 0; index < additional; index += 5) {
|
|
await Promise.all(Array.from({ length: 5 }, claim))
|
|
}
|
|
assert.equal(Number((await pool.query("SELECT admissions FROM server_poll_storage_usage WHERE scope=$1",["owner:"+ownerId])).rows[0].admissions),additional)
|
|
assert.equal(Number((await pool.query("SELECT admissions FROM server_poll_storage_usage WHERE scope='global'")).rows[0].admissions),globalBefore + additional)
|
|
assert.equal((await pool.query("SELECT count(*)::int AS n FROM server_poll_storage_admissions")).rows[0].n,globalBefore + additional)
|
|
assert.equal((await pool.query("SELECT count(*)::int AS n FROM server_poll_storage_usage WHERE scope<>'global' AND admissions=0")).rows[0].n,0)
|
|
const evidence=await(await import("./server-poll-storage-restore-evidence.sql-helper.js")).pollStorageRestoreEvidence(pool)
|
|
const stateDir = resolve(process.env.MCP_STATE_DIR!)
|
|
await mkdir(stateDir, { recursive: true, mode: 0o700 })
|
|
await writeFile(resolve(stateDir,"poll-storage-owned-restore-evidence.json"),JSON.stringify(evidence),{flag:"wx",mode:0o600})
|
|
return {globalAdmissions:globalBefore + additional,ownerAdmissions:additional,concurrentAdmissions:true,zeroOrphanCounters:true}
|
|
}
|