مدوَّنة سريعة وحديثة مدعومة بـ VeloCMS

Next.jsTypeScriptPostgresLinuxRust

مميز
Jan 10, 2026اقرأ المقالة ←
From the latest post
src/replication/migrate.tstypescript
// Wait for all replicas to catch up before applying the next migration.
async function awaitReplicaLag(pool: Pool, max: number) {
  while (true) {
    const { rows } = await pool.query("SELECT max(lag) AS lag FROM pg_stat_replication");
    if (rows[0].lag < max) return;
    await sleep(250);
  }
}