Skip to content

Commit

Permalink
Merge pull request #3598 from owid/fix-staging-deploy-queue
Browse files Browse the repository at this point in the history
fix(deploy-queue): pass transaction into deploy queue
  • Loading branch information
marcelgerber authored May 14, 2024
2 parents a269b43 + c101caa commit 1ed4a34
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions baker/startDeployQueueServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import * as db from "../db/db.js"
// by registering listeners on SIGINT.
import "../db/cleanup.js"

const runDeployIfQueueIsNotEmpty = async () =>
await db.knexReadWriteTransaction(
deployIfQueueIsNotEmpty,
db.TransactionCloseMode.KeepOpen
)

// TODO: The deploy queue is largely obsolete with buildkite but it's not visible in the admin yet so for now this code is kept
const main = async () => {
if (!fs.existsSync(DEPLOY_QUEUE_FILE_PATH)) {
Expand All @@ -31,14 +37,11 @@ const main = async () => {
fs.watchFile(DEPLOY_QUEUE_FILE_PATH, () => {
// Start deploy after 10 seconds in order to avoid the quick successive
// deploys triggered by Wordpress.
setTimeout(deployIfQueueIsNotEmpty, 10 * 1000)
setTimeout(runDeployIfQueueIsNotEmpty, 10 * 1000)
})

// TODO: this transaction is only RW because somewhere inside it we fetch images
await db.knexReadWriteTransaction(
deployIfQueueIsNotEmpty,
db.TransactionCloseMode.Close
)
void runDeployIfQueueIsNotEmpty()
}

void main()

0 comments on commit 1ed4a34

Please sign in to comment.