qdone 2.0.31-alpha → 2.0.32-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,8 +40,10 @@ class JobExecutor {
40
40
  if (this.opt.verbose) {
41
41
  console.error(chalk_1.default.blue('Shutting down jobExecutor'));
42
42
  }
43
- await this.maintainPromise;
44
- await this.maintainVisibility();
43
+ while (this.stats.activeJobs > 0) {
44
+ await this.maintainPromise;
45
+ await this.maintainVisibility();
46
+ }
45
47
  }
46
48
  activeJobCount() {
47
49
  return this.stats.activeJobs;
@@ -117,7 +119,24 @@ class JobExecutor {
117
119
  }
118
120
  if (this.opt.verbose) {
119
121
  console.error(chalk_1.default.blue('Stats: '), { stats: this.stats, jobStatuses });
120
- console.error(chalk_1.default.blue('Running: '), this.jobs.filter(j => j.status === 'processing').map(({ qname, message }) => ({ qname, payload: message.Body })));
122
+ console.error(chalk_1.default.blue('Jobs: '));
123
+ for (const [qname, jobs] of this.jobsByQueue.entries()) {
124
+ 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);
129
+ 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);
138
+ }
139
+ }
121
140
  }
122
141
  // Extend in batches for each queue
123
142
  for (const qrl in jobsToExtendByQrl) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "qdone",
3
- "version": "2.0.31-alpha",
3
+ "version": "2.0.32-alpha",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "qdone",
9
- "version": "2.0.31-alpha",
9
+ "version": "2.0.32-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.31-alpha",
3
+ "version": "2.0.32-alpha",
4
4
  "description": "Language agnostic job queue for SQS",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -41,8 +41,10 @@ export class JobExecutor {
41
41
  if (this.opt.verbose) {
42
42
  console.error(chalk.blue('Shutting down jobExecutor'))
43
43
  }
44
- await this.maintainPromise
45
- await this.maintainVisibility()
44
+ while (this.stats.activeJobs > 0) {
45
+ await this.maintainPromise
46
+ await this.maintainVisibility()
47
+ }
46
48
  }
47
49
 
48
50
  activeJobCount () {
@@ -124,7 +126,16 @@ export class JobExecutor {
124
126
 
125
127
  if (this.opt.verbose) {
126
128
  console.error(chalk.blue('Stats: '), { stats: this.stats, jobStatuses })
127
- console.error(chalk.blue('Running: '), this.jobs.filter(j => j.status === 'processing').map(({ qname, message }) => ({ qname, payload: message.Body })))
129
+ console.error(chalk.blue('Jobs: '))
130
+ for (const [qname, jobs] of this.jobsByQueue.entries()) {
131
+ if (jobs.size) {
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)
137
+ }
138
+ }
128
139
  }
129
140
 
130
141
  // Extend in batches for each queue