<commit_before>// Type definitions for bull 3.5
// Project: https://github.com/OptimalBits/bull
// Definitions by: <NAME> <https://github.com/bgrieder>
//                 <NAME> <https://github.com/JProgrammer>
//                 <NAME> <https://github.com/marshall007>
//                 Weeco <https://github.com/weeco>
//                 <NAME> <https://github.com/blaugold>
//                 <NAME> <https://github.com/iamolegga>
//                 <NAME> <https://github.com/koblas>
//                 <NAME> <https://github.com/bondz>
//                 Wuha Team <https://github.com/wuha-team>
//                 <NAME> <https://github.com/aleccool213>
//                 <NAME> <https://github.com/danmana>
//                 <NAME> <https://github.com/kjellmorten>
//                 <NAME>. <https://github.com/pc-jedi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import * as Redis from "ioredis";

/**
 * This is the Queue constructor.
 * It creates a new Queue that is persisted in Redis.
 * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session.
 */
declare const Bull: {
  (queueName: string, opts?: Bull.QueueOptions): Bull.Queue;
  (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures
  new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue;
  new (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures
};

declare namespace Bull {
  interface RateLimiter {
    /** Max numbers of jobs processed */
    max: number;
    /** Per duration in milliseconds */
    duration: number;
  }

  interface QueueOptions {
    /**
     * Options passed directly to the `ioredis` constructor
     */
    redis?: Redis.RedisOptions;

    /**
     * When specified, the `Queue` will use this function to create new `ioredis` client connections.
     * This is useful if you want to re-use connections.
     */
    createClient?(type: 'client' | 'subscriber' | 'bclient', redisOpts?: Redis.RedisOptions): Redis.Redis;

    /**
     * Prefix to use for all redis keys
     */
    prefix?: string;

    settings?: AdvancedSettings;

    limiter?: RateLimiter;

    defaultJobOptions?: JobOptions;
  }

  interface AdvancedSettings {
    /**
     * Key expiration time for job locks
     */
    lockDuration?: number;

    /**
     * How often check for stalled jobs (use 0 for never checking)
     */
    stalledInterval?: number;

    /**
     * Max amount of times a stalled job will be re-processed
     */
    maxStalledCount?: number;

    /**
     * Poll interval for delayed jobs and added jobs
     */
    guardInterval?: number;

    /**
     * Delay before processing next job in case of internal error
     */
    retryProcessDelay?: number;

    /**
     * Define a custom backoff strategy
     */
    backoffStrategies?: {
      [key: string]: (attemptsMade: number, err: Error) => number;
    };

    /**
     * A timeout for when the queue is in `drained` state (empty waiting for jobs).
     * It is used when calling `queue.getNextJob()`, which will pass it to `.brpoplpush` on the Redis client.
     */
    drainDelay?: number;
  }

  type DoneCallback = (error?: Error | null, value?: any) => void;

  type JobId = number | string;

  interface Job<T = any> {
    id: JobId;

    /**
     * The custom data passed when the job was created
     */
    data: T;

    /**
     * How many attempts where made to run this job
     */
    attemptsMade: number;

    /**
     * When this job was started (unix milliseconds)
     */
    processedOn?: number;

    /**
     * When this job was completed (unix milliseconds)
     */
    finishedOn?: number;
      
    /**
     * Which queue this job was part of
     */
    queue: Queue<T>;
      
    timestamp: number;
      
    /**
     * The named processor name
     */
    name: string;
    
    /**
     * The stacktrace for any errors
     */
    stacktrace: string[];
      
    returnvalue: any;

    /**
     * Report progress on a job
     */
    progress(value: any): Promise<void>;

    /**
     * Returns a promise resolving to the current job's status.
     * Please take note that the implementation of this method is not very efficient, nor is
     * it atomic. If your queue does have a very large quantity of jobs, you may want to
     * avoid using this method.
     */
    getState(): Promise<JobStatus>;

    /**
     * Update a specific job's data. Promise resolves when the job has been updated.
     */
    update(data: any): Promise<void>;

    /**
     * Removes a job from the queue and from any lists it may be included in.
     * The returned promise resolves when the job has been removed.
     */
    remove(): Promise<void>;

    /**
     * Re-run a job that has failed. The returned promise resolves when the job<commit_msg>Update index.d.ts<commit_after>// Type definitions for bull 3.5
// Project: https://github.com/OptimalBits/bull
// Definitions by: <NAME> <https://github.com/bgrieder>
//                 <NAME> <https://github.com/JProgrammer>
//                 <NAME> <https://github.com/marshall007>
//                 Weeco <https://github.com/weeco>
//                 <NAME> <https://github.com/blaugold>
//                 <NAME> <https://github.com/iamolegga>
//                 <NAME> <https://github.com/koblas>
//                 <NAME> <https://github.com/bondz>
//                 Wuha Team <https://github.com/wuha-team>
//                 <NAME> <https://github.com/aleccool213>
//                 <NAME> <https://github.com/danmana>
//                 <NAME> <https://github.com/kjellmorten>
//                 <NAME>. <https://github.com/pc-jedi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import * as Redis from "ioredis";

/**
 * This is the Queue constructor.
 * It creates a new Queue that is persisted in Redis.
 * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session.
 */
declare const Bull: {
  (queueName: string, opts?: Bull.QueueOptions): Bull.Queue;
  (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures
  new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue;
  new (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures
};

declare namespace Bull {
  interface RateLimiter {
    /** Max numbers of jobs processed */
    max: number;
    /** Per duration in milliseconds */
    duration: number;
  }

  interface QueueOptions {
    /**
     * Options passed directly to the `ioredis` constructor
     */
    redis?: Redis.RedisOptions;

    /**
     * When specified, the `Queue` will use this function to create new `ioredis` client connections.
     * This is useful if you want to re-use connections.
     */
    createClient?(type: 'client' | 'subscriber' | 'bclient', redisOpts?: Redis.RedisOptions): Redis.Redis;

    /**
     * Prefix to use for all redis keys
     */
    prefix?: string;

    settings?: AdvancedSettings;

    limiter?: RateLimiter;

    defaultJobOptions?: JobOptions;
  }

  interface AdvancedSettings {
    /**
     * Key expiration time for job locks
     */
    lockDuration?: number;

    /**
     * How often check for stalled jobs (use 0 for never checking)
     */
    stalledInterval?: number;

    /**
     * Max amount of times a stalled job will be re-processed
     */
    maxStalledCount?: number;

    /**
     * Poll interval for delayed jobs and added jobs
     */
    guardInterval?: number;

    /**
     * Delay before processing next job in case of internal error
     */
    retryProcessDelay?: number;

    /**
     * Define a custom backoff strategy
     */
    backoffStrategies?: {
      [key: string]: (attemptsMade: number, err: Error) => number;
    };

    /**
     * A timeout for when the queue is in `drained` state (empty waiting for jobs).
     * It is used when calling `queue.getNextJob()`, which will pass it to `.brpoplpush` on the Redis client.
     */
    drainDelay?: number;
  }

  type DoneCallback = (error?: Error | null, value?: any) => void;

  type JobId = number | string;

  interface Job<T = any> {
    id: JobId;

    /**
     * The custom data passed when the job was created
     */
    data: T;

    /**
     * How many attempts where made to run this job
     */
    attemptsMade: number;

    /**
     * When this job was started (unix milliseconds)
     */
    processedOn?: number;

    /**
     * When this job was completed (unix milliseconds)
     */
    finishedOn?: number;

    /**
     * Which queue this job was part of
     */
    queue: Queue<T>;

    timestamp: number;

    /**
     * The named processor name
     */
    name: string;

    /**
     * The stacktrace for any errors
     */
    stacktrace: string[];

    returnvalue: any;

    /**
     * Report progress on a job
     */
    progress(value: any): Promise<void>;

    /**
     * Returns a promise resolving to the current job's status.
     * Please take note that the implementation of this method is not very efficient, nor is
     * it atomic. If your queue does have a very large quantity of jobs, you may want to
     * avoid using this method.
     */
    getState(): Promise<JobStatus>;

    /**
     * Update a specific job's data. Promise resolves when the job has been updated.
     */
    update(data: any): Promise<void>;

    /**
     * Removes a job from the queue and from any lists it may be included in.
     * The returned promise resolves when the job has been removed.
     */
    remove(): Promise<void>;

    /**
     * Re-run a job that has failed. The returned promise resolves when the job
{'fraction_non_alphanumeric': 0.11857229280096794, 'fraction_numerical': 0.0022181891510385156, 'mean_word_length': 2.2351598173515983, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 67, 'https://': 30, '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': '6235986', 'n_tokens_mistral': 2919, 'n_tokens_neox': 2819, 'n_words': 974}