diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-08-25 23:07:07 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-08-25 23:07:07 +0200 |
| commit | 107593094876a87adc95d9695701cb97faea1236 (patch) | |
| tree | 3a6b14ccc254b906637dc9905a726b8fcb3c15af | |
| parent | 93aa94dc157db3c722e1f1921df983bde9c4bd00 (diff) | |
| download | processor-107593094876a87adc95d9695701cb97faea1236.tar.gz processor-107593094876a87adc95d9695701cb97faea1236.zip | |
clone msg objects to allow resending 1:1 into the failed queue
| -rw-r--r-- | worker.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -333,7 +333,9 @@ amqp.connect(RABBITMQ_URI).then(async (rabbit) => { // populate `_records` // data from `/players` player_objects.forEach((msg) => { - let player = flatten(msg.content); + // flatten a deep clone, the original object is needed + // so it can be moved into the failed queue + let player = flatten(JSON.parse(JSON.stringify(msg.content))); player.created_at = new Date(Date.parse(player.created_at)); player.last_match_created_date = player.created_at; @@ -351,7 +353,7 @@ amqp.connect(RABBITMQ_URI).then(async (rabbit) => { // data from `/matches` match_objects.forEach((msg) => { - let match = msg.content; + let match = JSON.parse(JSON.stringify(msg.content)); // deep clone match.createdAt = new Date(Date.parse(match.createdAt)); // flatten jsonapi nested response into our db structure-like shape |
