21 lines
1.3 KiB
TypeScript
21 lines
1.3 KiB
TypeScript
import {assertOwnedBandwidthSql,prepareOwnedBandwidthState} from "./bandwidth-admission-process.sql-helper.js"
|
|
|
|
assertOwnedBandwidthSql();await prepareOwnedBandwidthState()
|
|
const {pool,closePool}=await import("../db/index.js")
|
|
const {applySqlMigrations}=await import("../db/migrate.js")
|
|
const ids:number[]=[]
|
|
try{
|
|
await applySqlMigrations(pool)
|
|
const {acceptOperationLockLifetimeSql}=await import("./operation-config-lock-lease.sql-helper.js")
|
|
console.log("Owned operation lock lifetime: "+JSON.stringify(await acceptOperationLockLifetimeSql()))
|
|
for(let index=0;index<2;index++)ids.push(Number((await pool.query("INSERT INTO public.servers(name,host,enabled) VALUES('owned-routing-pool','127.0.0.1',false) RETURNING id")).rows[0].id))
|
|
const {acceptRoutingMeasurementPoolSql}=await import("../modules/mcp/routing-measurement-pool.sql-helper.js")
|
|
const routing=await acceptRoutingMeasurementPoolSql(ids)
|
|
console.log("Owned operation lock routing: "+JSON.stringify(routing))
|
|
const {acceptAutomaticSchedulerSql}=await import("./scheduler-automatic-root.sql-helper.js")
|
|
console.log("Owned automatic scheduler: "+JSON.stringify(await acceptAutomaticSchedulerSql(ids)))
|
|
}finally{
|
|
try{if(ids.length)await pool.query("DELETE FROM public.servers WHERE id=ANY($1::bigint[])",[ids])}
|
|
finally{await closePool()}
|
|
}
|