summaryrefslogtreecommitdiff
path: root/worker.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-23 11:30:37 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-23 11:30:37 +0200
commit8df0cbac4a22d58879d74abed9d110485f438f79 (patch)
tree9fc7aef5347be04a6396c0699eec9a80c92a861f /worker.js
parent0770ae262b358d810a012591136612c48fa47492 (diff)
downloadcruncher-8df0cbac4a22d58879d74abed9d110485f438f79.tar.gz
cruncher-8df0cbac4a22d58879d74abed9d110485f438f79.zip
fuck transactions…
Diffstat (limited to 'worker.js')
-rw-r--r--worker.js29
1 files changed, 13 insertions, 16 deletions
diff --git a/worker.js b/worker.js
index fab57b9..1de5746 100644
--- a/worker.js
+++ b/worker.js
@@ -198,23 +198,20 @@ function* chunks(arr) {
async function calculate_global_point() {
logger.info("crunching global stats, this could take a while");
- await seq.transaction({ autocommit: false }, async (transaction) => {
- await Promise.map(global_points, async (tuple, idx, len) => {
- const progress = Math.floor(100*100 * (1-idx/len)) / 100,
- where_aggr = tuple[0], where_links = tuple[1];
- // aggregate participant_stats with our condition
- let stats = await aggregate_stats(where_aggr);
- if (stats != undefined) {
- stats.updated_at = seq.fn("NOW");
- logger.info("inserting global stat",
- { progress: progress });
- Object.assign(stats, where_links);
- await model.GlobalPoint.upsert(stats,
- { transaction: transaction });
- } else logger.warn("not enough data for this global stat!",
+ await Promise.map(global_points, async (tuple, idx, len) => {
+ const progress = Math.floor(100*100 * (1-idx/len)) / 100,
+ where_aggr = tuple[0], where_links = tuple[1];
+ // aggregate participant_stats with our condition
+ let stats = await aggregate_stats(where_aggr);
+ if (stats != undefined) {
+ stats.updated_at = seq.fn("NOW");
+ logger.info("inserting global stat",
{ progress: progress });
- }, { concurrency: MAXCONNS });
- });
+ Object.assign(stats, where_links);
+ await model.GlobalPoint.upsert(stats);
+ } else logger.warn("not enough data for this global stat!",
+ { progress: progress });
+ }, { concurrency: MAXCONNS });
logger.info("committing");
}