qdone 2.0.32-alpha → 2.0.33-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,10 +40,8 @@ class JobExecutor {
40
40
  if (this.opt.verbose) {
41
41
  console.error(chalk_1.default.blue('Shutting down jobExecutor'));
42
42
  }
43
- while (this.stats.activeJobs > 0) {
44
- await this.maintainPromise;
45
- await this.maintainVisibility();
46
- }
43
+ await this.maintainPromise;
44
+ await this.maintainVisibility();
47
45
  }
48
46
  activeJobCount() {
49
47
  return this.stats.activeJobs;
@@ -122,19 +120,18 @@ class JobExecutor {
122
120
  console.error(chalk_1.default.blue('Jobs: '));
123
121
  for (const [qname, jobs] of this.jobsByQueue.entries()) {
124
122
  if (jobs.size) {
125
- console.error(chalk_1.default.blue(' queue:'), qname);
126
- for (const job of jobs)
127
- if (job.status === 'running')
128
- console.error(chalk_1.default.green(' running: '), job.payload);
123
+ const stats = {};
129
124
  for (const job of jobs)
130
- if (job.status === 'waiting')
131
- console.error(chalk_1.default.gold(' waiting:'), job.payload);
132
- for (const job of jobs)
133
- if (job.status === 'complete' || job.status === 'deleting')
134
- console.error(chalk_1.default.blue(' complete:'), job.payload);
135
- for (const job of jobs)
136
- if (job.status === 'failed')
137
- console.error(chalk_1.default.red(' failed:'), job.payload);
125
+ stats[job.status] = (stats[job.status] || 0) + 1;
126
+ console.error(chalk_1.default.blue(' queue:'), qname);
127
+ if (stats.running)
128
+ console.error(chalk_1.default.green(' running: '), stats.running);
129
+ if (stats.waiting)
130
+ console.error(chalk_1.default.yellow(' waiting: '), stats.waiting);
131
+ if (stats.deleting)
132
+ console.error(chalk_1.default.blue(' complete: '), stats.deleting);
133
+ if (stats.failed)
134
+ console.error(chalk_1.default.red(' failed: '), stats.failed);
138
135
  }
139
136
  }
140
137
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.32-alpha",
3
+ "version": "2.0.33-alpha",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "qdone",
9
- "version": "2.0.32-alpha",
9
+ "version": "2.0.33-alpha",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cloudwatch": "3.465.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.32-alpha",
3
+ "version": "2.0.33-alpha",
4
4
  "description": "Language agnostic job queue for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -41,10 +41,8 @@ export class JobExecutor {
41
41
  if (this.opt.verbose) {
42
42
  console.error(chalk.blue('Shutting down jobExecutor'))
43
43
  }
44
- while (this.stats.activeJobs > 0) {
45
- await this.maintainPromise
46
- await this.maintainVisibility()
47
- }
44
+ await this.maintainPromise
45
+ await this.maintainVisibility()
48
46
  }
49
47
 
50
48
  activeJobCount () {
@@ -129,11 +127,13 @@ export class JobExecutor {
129
127
  console.error(chalk.blue('Jobs: '))
130
128
  for (const [qname, jobs] of this.jobsByQueue.entries()) {
131
129
  if (jobs.size) {
130
+ const stats = {}
131
+ for (const job of jobs) stats[job.status] = (stats[job.status] || 0) + 1
132
132
  console.error(chalk.blue(' queue:'), qname)
133
- for (const job of jobs) if (job.status === 'running') console.error(chalk.green(' running: '), job.payload)
134
- for (const job of jobs) if (job.status === 'waiting') console.error(chalk.gold(' waiting:'), job.payload)
135
- for (const job of jobs) if (job.status === 'complete' || job.status === 'deleting') console.error(chalk.blue(' complete:'), job.payload)
136
- for (const job of jobs) if (job.status === 'failed') console.error(chalk.red(' failed:'), job.payload)
133
+ if (stats.running) console.error(chalk.green(' running: '), stats.running)
134
+ if (stats.waiting) console.error(chalk.yellow(' waiting: '), stats.waiting)
135
+ if (stats.deleting) console.error(chalk.blue(' complete: '), stats.deleting)
136
+ if (stats.failed) console.error(chalk.red(' failed: '), stats.failed)
137
137
  }
138
138
  }
139
139
  }