This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
start: function(_api, next) { | |
var maxWorkerAge = 10000; | |
api.log('Removing stuck workers older than ' + maxWorkerAge + 'ms', 'info'); | |
api.resque.queue.cleanOldWorkers(maxWorkerAge, function(err, result) { | |
if (err) { | |
api.log(err, 'error'); | |
} | |
if (Object.keys(result).length > 0) { | |
api.log('Removed stuck workers with errors: ', 'info', result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Redis = require('redis'); | |
const Config = require('./config.js'); | |
const Log = require('./log.js'); | |
let redisClient = Redis.createClient(Config.redis.uri); | |
// Locking utility function. This is based on https://github.com/errorception/redis-lock but we only needed a simple use-case of it, | |
// and redis-lock continually retries - we wanted to fail immediately if a lock was in use. | |
class Lock { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8.6.0 | |
#USER node | |
# Deal with node-gyp permissions issues in Docker | |
RUN npm -g config set user root | |
RUN mkdir /root/.npm-global | |
ENV PATH=/root/.npm-global/bin:$PATH | |
ENV NPM_CONFIG_PREFIX=/root/.npm-global | |
# Base tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v8.6.0 | |
5.3.0 | |
[email protected] /Users/chad/projects/paltalk/webng/chat | |
├─┬ @webng/[email protected] | |
│ └── @webng/[email protected] deduped | |
├─┬ @webng/[email protected] | |
│ ├── [email protected] deduped | |
│ └── [email protected] deduped | |
├─┬ @webng/[email protected] | |
│ ├─┬ [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script uses a shallow-get technique to get a list of all top level keys | |
# in a Firebase Realtime Database, then extract the tree under each key into a | |
# separate JSON file, one per top level key. | |
# | |
# It’s great for making backups because you don’t end up with one ginormous | |
# export file which is really hard to manage with other tools. | |
# | |
# It can also immediately give you a sense of where your space is going per key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set NODE_ENV to test so AH creates api.specHelper for us | |
process.env.NODE_ENV = 'test'; | |
process.env.ACTIONHERO_CONFIG = 'config,local-config'; | |
// Get ActionHero ready to go | |
var actionheroPrototype = require('actionhero').actionheroPrototype, | |
actionhero = new actionheroPrototype(), | |
running = false; | |
global.api = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Promise = require('bluebird'), | |
pbkdf2 = require('pbkdf2'), | |
jwt = require('jsonwebtoken'), | |
encryptionIterations = 10000, | |
publicApi = {}, | |
api; | |
/** | |
* This is an example, but fully functional, session middleware for ActionHero. | |
* It's based on three design principles: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pendingNotifications = {}, | |
publicApi = {}, | |
api; | |
// Dummy function to avoid an Unhandled Rejection error if the user is offline. Prevents us | |
// from needing to .catch() the notification result in every spot where we call it. Also a | |
// useful debugging point, so we don't just null it out. | |
function userNotOnline() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set NODE_ENV to test so AH creates api.specHelper for us | |
process.env.NODE_ENV = 'test'; | |
process.env.ACTIONHERO_CONFIG = 'config,local-config'; | |
// Get ActionHero ready to go | |
var actionheroPrototype = require('actionhero').actionheroPrototype, | |
actionhero = new actionheroPrototype(), | |
running = false; | |
global.api = null; |