Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

better-queue

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-queue - npm Package Compare versions

Comparing version 3.7.7 to 3.7.8

48

lib/stores/PostgresAdapter.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc