better-queue
Advanced tools
Comparing version 3.7.7 to 3.7.8
@@ -33,26 +33,26 @@ var _ = require('lodash'); | ||
PostgresAdapter.prototype.initialize = function (cb) { | ||
var sql = ' \n\ | ||
CREATE FUNCTION upsert_' + this.tableName + '(_id TEXT, _lock TEXT, _task TEXT, _priority NUMERIC) RETURNS VOID AS \n\ | ||
$$ \n\ | ||
BEGIN \n\ | ||
LOOP \n\ | ||
-- first try to update the key \n\ | ||
-- note that "id" must be unique \n\ | ||
UPDATE ' + this.tableName + ' SET lock=_lock, task=_task, priority=_priority WHERE id=_id; \n\ | ||
IF found THEN \n\ | ||
RETURN; \n\ | ||
END IF; \n\ | ||
-- not there, so try to insert the key \n\ | ||
-- if someone else inserts the same key concurrently, \n\ | ||
-- we could get a unique-key failure \n\ | ||
BEGIN \n\ | ||
INSERT INTO ' + this.tableName + ' (id, lock, task, priority) VALUES (_id, _lock, _task, _priority); \n\ | ||
RETURN; \n\ | ||
EXCEPTION WHEN unique_violation THEN \n\ | ||
-- do nothing, and loop to try the UPDATE again \n\ | ||
END; \n\ | ||
END LOOP; \n\ | ||
END; \n\ | ||
$$ \n\ | ||
LANGUAGE plpgsql; \n\ | ||
var sql = ' \n\ | ||
CREATE OR REPLACE FUNCTION upsert_' + this.tableName + '(_id TEXT, _lock TEXT, _task TEXT, _priority NUMERIC) RETURNS VOID AS \n\ | ||
$$ \n\ | ||
BEGIN \n\ | ||
LOOP \n\ | ||
-- first try to update the key \n\ | ||
-- note that "id" must be unique \n\ | ||
UPDATE ' + this.tableName + ' SET lock=_lock, task=_task, priority=_priority WHERE id=_id; \n\ | ||
IF found THEN \n\ | ||
RETURN; \n\ | ||
END IF; \n\ | ||
-- not there, so try to insert the key \n\ | ||
-- if someone else inserts the same key concurrently, \n\ | ||
-- we could get a unique-key failure \n\ | ||
BEGIN \n\ | ||
INSERT INTO ' + this.tableName + ' (id, lock, task, priority) VALUES (_id, _lock, _task, _priority); \n\ | ||
RETURN; \n\ | ||
EXCEPTION WHEN unique_violation THEN \n\ | ||
-- do nothing, and loop to try the UPDATE again \n\ | ||
END; \n\ | ||
END LOOP; \n\ | ||
END; \n\ | ||
$$ \n\ | ||
LANGUAGE plpgsql; \n\ | ||
'; | ||
@@ -59,0 +59,0 @@ this.run(sql, function (err) { |
{ | ||
"name": "better-queue", | ||
"version": "3.7.7", | ||
"version": "3.7.8", | ||
"description": "Better Queue for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "lib/queue.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
90751
3