This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
bandolier-template/lib/queues.js

47 lines
1.3 KiB

import Queue from 'bull';
export const create = (name) => {
// I'm not clear on the semantics of the bull queues.
// Should I make one per process and use it in all functions?
// Or, make one for every place I need it and don't share them?
return new Queue(name);
}
export const send_registration = (user) => {
const mail = create("mail/registration");
mail.add({user});
}
export const send_welcome = (user) => {
const mail = create("mail/welcome");
mail.add({user});
}
export const send_receipt = (user, payment_id, product_id) => {
const mail = create("mail/receipt");
mail.add({user, payment_id, product_id});
}
export const send_reset = (user, ip_address, browser) => {
const mail = create("mail/reset");
mail.add({user, ip_address, browser});
}
export const send_reset_finished = (user, ip_address, browser) => {
const mail = create("mail/reset_finished");
mail.add({user, ip_address, browser});
}
export const send_update_viewers = (api_key) => {
const live = create("live/update_viewers");
live.add({api_key});
}
export const add_view_count = (livestream_id) => {
const live = create("live/add_view_count");
live.add({livestream_id});
}
export default {
create, send_welcome, send_reset, send_reset_finished, send_update_viewers
}