• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

violinist-dev / queue-starter / 18861477155

09 Oct 2025 04:17PM UTC coverage: 70.85%. Remained the same
18861477155

push

github

web-flow
we don't need composer 1 (#169)

64 of 115 branches covered (55.65%)

Branch coverage included in aggregate %.

286 of 379 relevant lines covered (75.46%)

50.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.14
/src/start.ts
1
const createJob = require('./createJob')
4✔
2
const bunyan = require('bunyan')
4✔
3
const createCloudJob = require('./createCloudJob').createCloudJob
4✔
4
const createPruneJob = require('./createPruneJob')
4✔
5
const createPullJob = require('./createPullJob')
4✔
6
const supportedPhpVersions = require('./supportedPhpVersions')
4✔
7
const sleep = require('await-sleep')
4✔
8
const git = require('git-rev')
4✔
9
var gitRev
10
git.short(function (str) {
4✔
11
  gitRev = str
4✔
12
})
13
const findJob = require('./findJob')
4✔
14

15
var stopTheThing = false
4✔
16
function stopIt () {
17
  stopTheThing = true
4✔
18
}
19

20
const queue = require('queue')
4✔
21
var startFuncQueue = queue()
4✔
22
startFuncQueue.concurrency = 1
4✔
23

24
async function createStart (config, q, cloudQueue) {
25
  if (stopTheThing) {
461✔
26
    return
2✔
27
  }
28
  const sleepTime = config.sleepTime ? config.sleepTime : 1000
459!
29
  const cloudSleepTime = config.cloudSleepTime ? config.cloudSleepTime : 3000
459!
30
  const completeCallback = config.completeCallback ? config.completeCallback : start
459!
31
  const log = bunyan.createLogger({ name: 'queue-starter', hostname: config.hostname })
459✔
32
  const job = await findJob(log, config)
459✔
33
  if (!job || !job.data || !job.data.job_id) {
481✔
34
    if (config.runCloud) {
437!
35
      await sleep(cloudSleepTime)
874✔
36
      await completeCallback(config, q, cloudQueue)
874✔
37
      return
437✔
38
    }
39
    if (!q.length && !cloudQueue.length) {
×
40
      await sleep(sleepTime)
×
41
      if (!q.length && !cloudQueue.length) {
×
42
        await completeCallback(config, q, cloudQueue)
×
43
      }
44
    } else {
45
      log.info('It seems we already have a something in the queue, trusting job search to be coming up')
×
46
    }
47
    return
×
48
  }
49
  if (config.runCloud) {
22!
50
    log.info('Starting cloud job')
22✔
51
    const run = createCloudJob(config, job, gitRev)
22✔
52
    cloudQueue.push(run)
22✔
53
    cloudQueue.start()
22✔
54
    await sleep(cloudSleepTime)
44✔
55
    await completeCallback(config, q, cloudQueue)
44✔
56
  } else {
57
    const run = createJob(config, job, gitRev)
×
58
    q.push(run)
×
59
    q.start()
×
60
  }
61
}
62

63
async function start (config, q, cloudQueue) {
64
  startFuncQueue.push(createStart.bind(null, config, q, cloudQueue))
461✔
65
  startFuncQueue.start()
461✔
66
}
67

68
async function queuePull (config, q) {
69
  if (config.runCloud) {
×
70
    return
×
71
  }
72
  const imgs = supportedPhpVersions
×
73
  const jobs = imgs.map(async (version) => {
×
74
    var imgs = [
×
75
        `${version}-multi-composer-2`
76
    ]
77
    imgs.forEach((img) => {
×
78
      q.push(createPullJob(img))
×
79
      q.push(createPruneJob(img))
×
80
    })
81
    q.start()
×
82
  })
83

84
  await Promise.all(jobs)
×
85
  setTimeout(queuePull.bind(null, config, q), (60 * 1000 * 60))
×
86
}
87

88
export { queuePull, start, stopIt }
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc