This file contains hidden or 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
ioredis:redis write command[0] -> multi() +2s | |
ioredis:redis write command[0] -> lrange(processing_batch:pageviews,0,99) +0ms | |
ioredis:redis write command[0] -> ltrim(processing_batch:pageviews,100,-1) +0ms | |
ioredis:redis write command[0] -> exec() +0ms | |
ioredis:redis write command[0] -> multi() +0ms | |
ioredis:redis write command[0] -> lrange(processing_batch:devices,0,99) +0ms | |
ioredis:redis write command[0] -> ltrim(processing_batch:devices,100,-1) +0ms | |
ioredis:redis write command[0] -> exec() +0ms | |
ioredis:redis write command[0] -> multi() +0ms | |
ioredis:redis write command[0] -> lrange(processing_batch:events,0,99) +0ms |
This file contains hidden or 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
ReqlCompileError: Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead in: | |
r.table("sessions").get("1ba7f35d-8f61-4835-af4a-9d0a80e41c704browser310320151300") | |
.replace(function(var_2) { | |
return r.branch(var_2.eq(null), r.table("sessions").insert({ | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
visitor_id: "1ba7f35d-8f61-4835-af4a-9d0a80e41c70", | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
client_id: 4, | |
^^^^^^^^^^^^^ | |
origin: "browser", |
This file contains hidden or 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
// request arriving at 30/03/2015 15:29:59 | |
// ids will have a 30-minute window but they can be extended by activity | |
// first, try to find an active session in 30 minutes | |
r.table("sessions").between(r.now().sub(1800),r.now(),{index: "updated_at"}).orderBy(r.desc({index: "updated_at"})).limit(1).replace(function(row) { | |
return r.branch(row.eq(null), | |
r.table("sessions").insert({ // doesn't exist so insert a row with the current 30-minute window | |
id: "300320151500", | |
created_at: r.now(), | |
updated_at: r.now() | |
}), |
This file contains hidden or 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
// request arriving at 30/03/2015 15:29:59 | |
// ids will have a 30-minute window but they can be extended by activity | |
// this id is coming from redis or created and added to redis if it doesn't exist | |
r.table("sessions").get("300320151530").replace(function(row) { | |
return r.branch(row.eq(null), | |
{ // doesn't exist so insert a row with the current 30-minute window | |
id: "300320151500", | |
created_at: r.now(), | |
updated_at: r.now() | |
}, |
This file contains hidden or 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 diso = moment().tz("America/Sao_Paulo").format(), | |
d = r.ISO8601(diso); | |
r.table("pending_geo_sessions").delete({ | |
returnChanges: true, | |
durability: "soft" | |
}).do(function(data) { | |
return data("changes").default([]).map(function(session) { | |
return r.table("cached_geolocations").get(session("ip")).do(function(geo) { | |
return r.branch( |
This file contains hidden or 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 project_name = "YOUR_PROJECT_NAME", | |
project_url = 'YOUR_GIT_URL', | |
project_destination_server = 'USER@SERVER', | |
project_destination_dir = '/PROJECT_DIRECTORY', | |
webhookUri = "SLACK_TOKEN_URI", | |
Slack = require('slack-node'), | |
slack = new Slack(), | |
notify = function(text) { | |
slack.webhook({ | |
channel: "#notifications", |
This file contains hidden or 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 cluster = require('cluster'); | |
if(cluster.isMaster) { | |
cluster.fork() | |
.on('online', function() { | |
this.disconnect(); | |
}); | |
} else { | |
process.on('internalMessage', function(msg) { | |
console.log('internalMsg', msg); |
This file contains hidden or 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
[{"group":"2014-12-01T22:00:00-02:00","reduction":88},{"group":"2014-12-02T22:00:00-02:00","reduction":56},{"group":"2014-12-03T22:00:00-02:00","reduction":5}] |
This file contains hidden or 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
r.db("aidax").table("purchases").getAll("0f338aa9-0d16-4e00-8301-f5ddabf313de", { | |
index: "client_id" | |
}).eqJoin("session_id", r.db("aidax").table("sessions")).map(function(var_1) { | |
return var_1("left").merge({ | |
visitor_id: var_1("right")("visitor_id"), | |
session_properties: var_1("right")("properties"), | |
weather: var_1("right")("weather").default({ | |
}), | |
geo: var_1("right")("geo").default({ |
This file contains hidden or 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
ReqlRuntimeError: Cannot perform get_field on a non-object non-sequence `"bad_person"` in: | |
r.table("events").getAll(r.args([["bad_person", "buy"], ["real_person", "buy"], ["person", "buy"]]), { | |
index: "person_action" | |
}).group("person", "thing").max("created_at").ungroup().limit(10).group(r.row("group")(0)) | |
^^^^^^^^^^^^^^^^^ | |
.ungroup().map(function(var_43) { | |
return r.object(var_43("group"), var_43("reduction").map(function(var_44) { | |
return { | |
thing: var_44("group").nth(1), | |
last_actioned_at: var_44("reduction")("created_at").toEpochTime() |