diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-09-28 20:37:58 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-09-28 20:37:58 +0200 |
| commit | d6d291343269287f51c52baa42ff58ae9bca1e46 (patch) | |
| tree | 0a487d4fb5230a1587fc29a9de00e6d1b497ad21 | |
| parent | e042b74955c5d0829cd8b1f00213cd1398864d0b (diff) | |
| download | cruncher-d6d291343269287f51c52baa42ff58ae9bca1e46.tar.gz cruncher-d6d291343269287f51c52baa42ff58ae9bca1e46.zip | |
reject messages that aren't valid ids
| -rw-r--r-- | worker.js | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -120,6 +120,15 @@ amqp.connect(RABBITMQ_URI).then(async (rabbit) => { // set maximum allowed number of unacked msgs await ch.prefetch(BATCHSIZE); ch.consume(QUEUE, async (msg) => { + if (msg.content.length > 1024) { + // thx NodeJS for implementing `new Buffer(size)` + // Sometimes I fuck up during message sending + // and forget a `id.toString()`, creating huge blobs of zeros, + // which makes Sequelize panic because the packets are 2MB. + // May god forgive me for deploying debug code⦠+ await ch.nack(m, false, false); + } + participants.add(msg.content.toString()); buffer.add(msg); if (timeout == undefined) timeout = setTimeout(tryCrunch, LOAD_TIMEOUT*1000); |
