<commit_before>module.exports = function wrapper(maxTry, initialWait, cb) {
  return function(message, header, deliveryInfo, job) {
    header.retries = header.retries || 0;
    job.retry = function() {
      header.retries++;
      if(header.retries >= maxTry) {
        return cb(new Error('Message processing failed ' + maxTry + ' times'), message, header, deliveryInfo, job);
      }
      require('amqp-schedule')(job.queue.connection)(deliveryInfo.exchange, deliveryInfo.routingKey, message, Math.pow(2, header.retries)*initialWait, {
        contentType: deliveryInfo.contentType,
        headers: header
      });
    };<commit_msg>Flexible wait times<commit_after>module.exports = function wrapper(initialWait, maxTry, cb) {
  return function(message, header, deliveryInfo, job) {
    header.retries = header.retries || 0;
    job.retry = function(wait, tries) {
      if( wait === undefined ) {
        wait = initialWait;
      }
      if(tries === undefined) {
        tries = maxTry;
      }
      var delay = wait instanceof Array ? wait[header.retries] : Math.pow(2, header.retries)*wait;
      header.retries++;
      if(header.retries >= tries) {
        return cb(new Error('Message processing failed ' + maxTry + ' times'), message, header, deliveryInfo, job);
      }
      require('amqp-schedule')(job.queue.connection)(deliveryInfo.exchange, deliveryInfo.routingKey, message, delay, {
        contentType: deliveryInfo.contentType,
        headers: header
      });
    };
{'fraction_non_alphanumeric': 0.13119143239625167, 'fraction_numerical': 0.002677376171352075, 'mean_word_length': 3.259259259259259, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2285868', 'n_tokens_mistral': 429, 'n_tokens_neox': 428, 'n_words': 95}