<commit_before>var Rx = require("rx/dist/rx");
var Observable = Rx.Observable;
var SerialDisposable = Rx.SerialDisposable;

var GetRequest = require("falcor/request/GetRequest");
var SetRequest = require("falcor/request/SetRequest");

var prefix = require("falcor/internal/prefix");
var get_type = require("falcor/support/get-type");
var is_object = require("falcor/support/is-object");
var array_clone = require("falcor/support/array-clone");

function RequestQueue(model, scheduler) {
    this.total = 0;
    this.model = model;
    this.requests = [];
    this.scheduler = scheduler;
}

RequestQueue.prototype.get = function getRequest(paths) {

    var requests = this.distributePaths(paths, this.requests, GetRequest);

    return (Observable.create(function(observer) {

        var m = new SerialDisposable();

        m.setDisposable(Observable.fromArray(requests.map(function(request) {
            return request.getSourceObservable();
        })).subscribe(observer));

        return function dispose() {
            m.dispose();
            var paths2 = array_clone(paths);
            var pathCount = paths2.length;
            var requestIndex = -1;
            var requestCount = requests.length;
            while(pathCount > 0 && ++requestIndex < requestCount) {
                var request = requests[requestIndex];
                if(!request.pending) {
                    continue;
                }
                var pathIndex = -1;
                while(++pathIndex < pathCount) {
                    var path = paths2[pathIndex];
                    if(request.removePath(path)) {
                        paths2.splice(pathIndex--, 1);
                        if(--pathCount === 0) {
                            break;
                        }<commit_msg>Removes canceled paths from pending batches.<commit_after>var Rx = require("rx/dist/rx");
var Observable = Rx.Observable;
var SerialDisposable = Rx.SerialDisposable;

var GetRequest = require("falcor/request/GetRequest");
var SetRequest = require("falcor/request/SetRequest");

var prefix = require("falcor/internal/prefix");
var get_type = require("falcor/support/get-type");
var is_object = require("falcor/support/is-object");
var array_clone = require("falcor/support/array-clone");

function RequestQueue(model, scheduler) {
    this.total = 0;
    this.model = model;
    this.requests = [];
    this.scheduler = scheduler;
}

RequestQueue.prototype.get = function getRequest(paths) {

    var requests = this.distributePaths(paths, this.requests, GetRequest);

    return (Observable.create(function(observer) {

        var m = new SerialDisposable();

        m.setDisposable(Observable.fromArray(requests.map(function(request) {
            return request.getSourceObservable();
        })).subscribe(observer));

        return function dispose() {
            m.dispose();
            var pathCount = paths.length;
            var requestIndex = -1;
            var requestCount = requests.length;
            while(pathCount > 0 && requestCount > 0 && ++requestIndex < requestCount) {
                var request = requests[requestIndex];
                // if(!request.pending) {
                //     continue;
                // }
                var pathIndex = -1;
                while(++pathIndex < pathCount) {
                    var path = paths[pathIndex];
                    if(request.removePath(path)) {
                        paths.splice(pathIndex--, 1);
                        if(--pathCount === 0) {
                            break;
                        }
                    }
                }
                if(request.length === 0) {
                    requests.splice(requestIndex--, 1);
                    if(--requestCount === 0) {
                        break;
{'fraction_non_alphanumeric': 0.11778656126482213, 'fraction_numerical': 0.005270092226613966, 'mean_word_length': 1.9725920125293657, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, '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': '6858317', 'n_tokens_mistral': 1050, 'n_tokens_neox': 964, 'n_words': 199}