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

bcycle

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcycle - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

migrations/02_program_last_fetched.sql

8

database.js

@@ -86,8 +86,8 @@ /// <reference path="type_declarations/index.d.ts" />

function fetchNext(public_api, callback) {
// find which program is the oldest
exports.db.SelectOne('program_last_fetched')
.orderBy("COALESCE(last_fetched, '1970-01-01')")
.execute(function (error, program) {
// find which program is the oldest and update it in one go.
// this is not entirely race-condition free, but pretty close!
exports.db.query("UPDATE program AS t1 SET last_fetched = NOW()\n FROM (SELECT * FROM program ORDER BY last_fetched LIMIT 1) AS t2\n WHERE t1.id = t2.id\n RETURNING *", [], function (error, programs) {
if (error)
return callback(error);
var program = programs[0];
logger.debug("[" + new Date().toISOString() + "] fetchNext: program.id=" + program.id);

@@ -94,0 +94,0 @@ public_api.listProgramKiosks(program.bcycle_program_id, function (error, public_api_kiosks) {

@@ -128,8 +128,12 @@ /// <reference path="type_declarations/index.d.ts" />

export function fetchNext(public_api: PublicAPI, callback: (error?: Error) => void) {
// find which program is the oldest
db.SelectOne('program_last_fetched')
.orderBy("COALESCE(last_fetched, '1970-01-01')")
.execute((error: Error, program: Program) => {
// find which program is the oldest and update it in one go.
// this is not entirely race-condition free, but pretty close!
db.query(`UPDATE program AS t1 SET last_fetched = NOW()
FROM (SELECT * FROM program ORDER BY last_fetched LIMIT 1) AS t2
WHERE t1.id = t2.id
RETURNING *`, [], (error: Error, programs: Program[]) => {
if (error) return callback(error);
var program = programs[0];
logger.debug(`[${new Date().toISOString()}] fetchNext: program.id=${program.id}`);

@@ -136,0 +140,0 @@

@@ -7,3 +7,3 @@ {

],
"version": "0.2.3",
"version": "0.2.4",
"homepage": "https://github.com/chbrown/bcycle",

@@ -10,0 +10,0 @@ "repository": "git://github.com/chbrown/bcycle.git",

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