Created
August 22, 2016 17:27
-
-
Save Polyrhythm/1efc8af9b2e546076c96a259e300fd3a to your computer and use it in GitHub Desktop.
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
import { NOTIFICATION_QUEUE_NAME } from './../../shared/config.js'; | |
import { notificationProducer } from './../notificationProducer.js'; | |
import { MOST_VIRAL } from './../../shared/constants/routes.js'; | |
import { logger } from './../../shared/logger.js'; | |
export default function mostViral (accountId, postId) { | |
// This module doesn't need to post to Redis, | |
// because one mostViral post triggers a notification | |
const payloads = [ | |
{ | |
topic: NOTIFICATION_QUEUE_NAME, | |
messages: { type: MOST_VIRAL, accountId, postId }, | |
} | |
]; | |
notificationProducer.send(payloads, (err) => { | |
if (err) { | |
logger.error(`Queue producer error: ${err}`); | |
} | |
}); | |
return payloads; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment