Skip to content

Instantly share code, notes, and snippets.

@Polyrhythm
Created August 22, 2016 17:27
Show Gist options
  • Save Polyrhythm/1efc8af9b2e546076c96a259e300fd3a to your computer and use it in GitHub Desktop.
Save Polyrhythm/1efc8af9b2e546076c96a259e300fd3a to your computer and use it in GitHub Desktop.
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