Skip to content

Instantly share code, notes, and snippets.

function handleSignals(){
helpers.log(p_id,`------------SIGINT Detected1!-------------`);
helpers.log(p_id,`------------SIGINT Detected2!-------------`);
req.post(`${webdomain}/api/p_id/end/${p_id}`, {form:{error:'',msg:'SIGINT DETECTED!'}}, function(err, res, body) {
helpers.log(p_id,`------------SIGINT Detected3!-------------`);
});
helpers.log(p_id,`------------SIGINT Detected4!-------------`);
function handleSignals(){
helpers.log(p_id,`------------SIGINT Detected!1-------------`);
request(`${webdomain}/api/p/end/${p_id}`,{
method: 'POST',
form: {
error: '',
msg:'SIGINT DETECTED!'
},
#!/bin/bash
main() {
pm2-docker start ${BOT_NAME}.json &
# Setup signal handler
trap 'sigtermHandler' SIGTERM
sleep 10
await retryTimeout(() => async () => {
await retryGoTo(() => page.goto(url, {timeout:120000,waitUntil: 'networkidle0'}),3, 20000);
await page.waitForSelector('html',{timeout:timeout_value})
await page.waitForSelector('div.controls', {timeout:5000});
await page.click('button.action-force',{delay:helpers.getRandomInt(100, 500)});
await page.waitFor(time*1000);
isPlayed=true;
return isPlayed
Hericks-Mac-Pro:docker-chrome-vnc herickpaiva$ docker run -p 5900:5900 hmpmarketing/chrome-vnc:2
(EE)
Fatal server error:
(EE) Server is already active for display 1
If this server is no longer running, remove /tmp/.X1-lock
and start again.
(EE)
xvfb failed to start.
FROM ubuntu:trusty
RUN apt-get update; apt-get clean
# Add a user for running applications.
RUN useradd apps
RUN mkdir -p /home/apps && chown apps:apps /home/apps
# Install x11vnc.
RUN apt-get install -y x11vnc
FROM ubuntu:trusty
RUN apt-get update; apt-get clean
# Add a user for running applications.
RUN useradd apps
RUN mkdir -p /home/apps && chown apps:apps /home/apps
# Install x11vnc.
RUN apt-get install -y x11vnc
const Promise = require('bluebird');
const mysql = require("../modules/mysql.js");
const es = require("../modules/es.js");
const cache = require("../modules/memcached.js");
const redis = require("../modules/redis.js");
const helpers = require("../modules/helpers.js");
const FpToMemcache = require("../modules/fptomemcache.js");
exports.iframe = function(req, res) {
async function has(id) {
const val = await cache.has(`actioncookiecap-${id}`);
return { val, id };
}
actionFilter.filterVisited = async function (actions) {
const results = await Promise.all(actions.map(has));
console.log(results) //Returns [ { val: false, id: 39708 }, { val: false, id: 39709 } ]
return results.filter(v => v.val).map(v => v.id);
}
actionFilter.filterVisited = function (actions) {
actions.forEach(function (action_id) {
let actioncookiecap_key = 'actioncookiecap-'+action_id;
return cache.has(actioncookiecap_key).then(function(val){
if(val!==false){
let index = actions.indexOf(action_id);
actions.splice(index, 1);