How to use the @slack/web-api.retryPolicies.rapidRetryPolicy function in @slack/web-api

To help you get started, we’ve selected a few @slack/web-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kaisermann / pr-slack-bot / src / api / slack.js View on Github external
const Logger = require('../includes/logger.js');
const DB = require('./db.js');
const { PRIVATE_TEST_CHANNELS } = require('../consts.js');

const { SLACK_BOT_TOKEN, SLACK_USER_TOKEN } = process.env;
const RTM = new RTMClient(SLACK_BOT_TOKEN);

const PR_REGEX = /github\.com\/([\w-.]*)?\/([\w-.]*?)\/pull\/(\d+)/i;
const PR_REGEX_GLOBAL = new RegExp(PR_REGEX.source, `${PR_REGEX.flags}g`);

const user_client = new WebClient(SLACK_USER_TOKEN, {
  retryConfig: retryPolicies.rapidRetryPolicy,
});
const bot_client = new WebClient(SLACK_BOT_TOKEN, {
  retryConfig: retryPolicies.rapidRetryPolicy,
});

exports.bot_client = bot_client;
exports.user_client = user_client;

const balancer = new Queue({
  rules: {
    common: {
      rate: 50,
      limit: 60,
      priority: 5,
    },
    send_message: {
      rate: 2,
      limit: 1,
      priority: 2,
github kaisermann / pr-slack-bot / src / api / slack.js View on Github external
const { WebClient, retryPolicies } = require('@slack/web-api');
const Queue = require('smart-request-balancer');
const memoize = require('memoizee');

const Logger = require('../includes/logger.js');
const DB = require('./db.js');
const { PRIVATE_TEST_CHANNELS } = require('../consts.js');

const { SLACK_BOT_TOKEN, SLACK_USER_TOKEN } = process.env;
const RTM = new RTMClient(SLACK_BOT_TOKEN);

const PR_REGEX = /github\.com\/([\w-.]*)?\/([\w-.]*?)\/pull\/(\d+)/i;
const PR_REGEX_GLOBAL = new RegExp(PR_REGEX.source, `${PR_REGEX.flags}g`);

const user_client = new WebClient(SLACK_USER_TOKEN, {
  retryConfig: retryPolicies.rapidRetryPolicy,
});
const bot_client = new WebClient(SLACK_BOT_TOKEN, {
  retryConfig: retryPolicies.rapidRetryPolicy,
});

exports.bot_client = bot_client;
exports.user_client = user_client;

const balancer = new Queue({
  rules: {
    common: {
      rate: 50,
      limit: 60,
      priority: 5,
    },
    send_message: {