<commit_before>(function() {
    var Resolute = function(opt, callback) {
        opt = opt || {};
        this.operation = opt.operation;
        this.maxRetry = opt.maxRetry || 3;
        this.callback = callback;
        this.delay = opt.delay || 1000;
    };

    Resolute.prototype.run = function(operation) {
        var self = this;

        var _checkForPromise = function(opt) {
            // Do we have a operation?
            var operation = (typeof opt === "undefined") ? this.operation : opt;

            switch (operation.constructor.name) {
                case "Promise":
                    return this.operation;
                case "Function":
                    return this.operation();
                default:
                    throw new Error("Operation was not a Function or Promise: " + opt.operation);
            }
        };

        var _fn = _checkForPromise.call(self, operation);

        var _delay = function(ms) {
            return new Promise(function(resolve, reject) {
                setTimeout(resolve, ms);
            });
        };

        var _retry = function(retryCount, maxRetry, fn, delay) {
            retryCount = retryCount || 1;
            var retryMechanism = function(err) {
                if (retryCount >= maxRetry) {
                    throw err;
                }
                return _delay(self.delay).then(_retry.bind(null, retryCount + 1, maxRetry, fn, delay));<commit_msg>use the right operation<commit_after>(function() {
    var Resolute = function(opt, callback) {
        opt = opt || {};
        this.operation = opt.operation;
        this.maxRetry = opt.maxRetry || 3;
        this.callback = callback;
        this.delay = opt.delay || 1000;
    };

    Resolute.prototype.run = function(operation) {
        var self = this;

        var _checkForPromise = function(opt) {
            // Do we have a operation?
            var operation = (typeof opt === "undefined") ? this.operation : opt;
            switch (operation.constructor.name) {
                case "Promise":
                    return operation;
                case "Function":
                    return operation();
                default:
                    throw new Error("Operation was not a Function or Promise: " + opt.operation);
            }
        };

        var _fn = _checkForPromise.call(self, operation);

        var _delay = function(ms) {
            return new Promise(function(resolve, reject) {
                setTimeout(resolve, ms);
            });
        };

        var _retry = function(retryCount, maxRetry, fn, delay) {
            retryCount = retryCount || 1;
            var retryMechanism = function(err) {
                if (retryCount >= maxRetry) {
                    throw err;
                }
                return _delay(self.delay).then(_retry.bind(null, retryCount + 1, maxRetry, fn, delay));
{'fraction_non_alphanumeric': 0.10693342531907554, 'fraction_numerical': 0.004829251466022766, 'mean_word_length': 1.5823686553873553, 'pattern_counts': {'":': 4, '<': 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': '2789205', 'n_tokens_mistral': 753, 'n_tokens_neox': 727, 'n_words': 192}