keuss 2.0.2 → 2.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/TODO +1 -0
- package/backends/postgres.js +13 -5
- package/package.json +1 -1
package/TODO
CHANGED
package/backends/postgres.js
CHANGED
|
@@ -10,12 +10,11 @@ const debug = require('debug')('keuss:Queue:postgres');
|
|
|
10
10
|
class PGQueue extends Queue {
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
//////////////////////////////////////////////
|
|
13
|
+
//////////////////////////////////////////////
|
|
15
14
|
constructor (name, factory, opts, orig_opts) {
|
|
16
15
|
super (name, factory, opts, orig_opts);
|
|
17
16
|
this._pool = factory._pool;
|
|
18
|
-
this._tbl_name = this._name;
|
|
17
|
+
this._tbl_name = pg.escapeIdentifier(`_k_tbl_${this._name}`);
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
|
|
@@ -42,8 +41,17 @@ class PGQueue extends Queue {
|
|
|
42
41
|
tries INTEGER DEFAULT 0 NOT NULL,
|
|
43
42
|
reserved TIMESTAMPTZ
|
|
44
43
|
);
|
|
45
|
-
CREATE INDEX IF NOT EXISTS
|
|
46
|
-
`, err =>
|
|
44
|
+
CREATE INDEX IF NOT EXISTS ${pg.escapeIdentifier('idx_' + this._tbl_name + '_mature')} ON ${this._tbl_name} (mature);
|
|
45
|
+
`, err => {
|
|
46
|
+
if (err){
|
|
47
|
+
// ignore catalog issues on concurrent table creation
|
|
48
|
+
// (duplicate key value violates unique constraint "pg_type_typname_nsp_index")
|
|
49
|
+
if (err.code == '23505') return cb()
|
|
50
|
+
return cb(err);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
cb ();
|
|
54
|
+
});
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
|