pg-boss 11.0.2 → 11.0.4

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  Queueing jobs in Postgres from Node.js like a boss.
2
2
 
3
- [![npm version](https://badge.fury.io/js/pg-boss.svg)](https://badge.fury.io/js/pg-boss)
3
+ [![npm version](https://badge.fury.io/js/pg-boss.svg?icon=si%3Anpm)](https://badge.fury.io/js/pg-boss)
4
4
  [![Build](https://github.com/timgit/pg-boss/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/timgit/pg-boss/actions/workflows/ci.yml)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/timgit/pg-boss/badge.svg?branch=master)](https://coveralls.io/github/timgit/pg-boss?branch=master)
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-boss",
3
- "version": "11.0.2",
3
+ "version": "11.0.4",
4
4
  "description": "Queueing jobs in Postgres from Node.js like a boss",
5
5
  "main": "./src/index.js",
6
6
  "engines": {
package/src/manager.js CHANGED
@@ -637,11 +637,11 @@ class Manager extends EventEmitter {
637
637
  const { table, partition } = await this.getQueueCache(name)
638
638
 
639
639
  if (partition) {
640
- const sql = plans.deleteAllJobs(this.config.schema, table)
641
- await this.db.executeSql(sql, [name])
642
- } else {
643
640
  const sql = plans.truncateTable(this.config.schema, table)
644
641
  await this.db.executeSql(sql)
642
+ } else {
643
+ const sql = plans.deleteAllJobs(this.config.schema, table)
644
+ await this.db.executeSql(sql, [name])
645
645
  }
646
646
  }
647
647
 
package/src/plans.js CHANGED
@@ -697,7 +697,7 @@ function insertJobs (schema, { table, name, returnId = true }) {
697
697
  j.start_after,
698
698
  "singletonKey",
699
699
  CASE
700
- WHEN "singletonSeconds" IS NOT NULL THEN 'epoch'::timestamp + '1s'::interval * ("singletonSeconds" * floor(( date_part('epoch', now()) + "singletonOffset") / "singletonSeconds" ))
700
+ WHEN "singletonSeconds" IS NOT NULL THEN 'epoch'::timestamp + '1s'::interval * ("singletonSeconds" * floor(( date_part('epoch', now()) + COALESCE("singletonOffset",0)) / "singletonSeconds" ))
701
701
  ELSE NULL
702
702
  END as singleton_on,
703
703
  COALESCE("expireInSeconds", q.expire_seconds) as expire_seconds,