<commit_before>import {Injectable, NgZone} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import {Subscription} from 'rxjs/Subscription';
import {Observer} from 'rxjs/Observer';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/multicast';


@Injectable()
export class PoolingService {
	constructor(private zone: NgZone) {}

	// NOTE: Running the interval outside Angular ensures that e2e tests will not hang.
	execute<T>(operation: () => Observable<T>, frequency: number = 1000): Observable<T> {
		const subject = new Subject();
		const source = Observable.create((observer: Observer<T>) => {
			let sub: Subscription;
			this.zone.runOutsideAngular(() => {
				const zone = this.zone;
				sub = Observable.interval(frequency)
					.mergeMap(operation)
					.subscribe({
						next(result) {
							zone.run(() => {
								observer.next(result);
							});
						},
						error(err) {
							zone.run(() => {
								observer.error(err);
							});
						}
					});
			});

			return () => {
				if (sub) {
					sub.unsubscribe();
				}
			};
		});


		return source.multicast(subject)
			.refCount();
	}
}<commit_msg>chore(PoolingService): revert to previous version<commit_after>import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ReplaySubject} from 'rxjs/ReplaySubject';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/multicast';


@Injectable()
export class PoolingService {
	// NOTE: Running the interval outside Angular ensures that e2e tests will not hang.
	execute<T>(operation: () => Observable<T>, frequency: number = 1000): Observable<T> {
		return Observable.interval(frequency)
			.mergeMap(operation)
			.multicast(() => new ReplaySubject())
			.refCount();
	}
}
{'fraction_non_alphanumeric': 0.1496021220159151, 'fraction_numerical': 0.005305039787798408, 'mean_word_length': 3.8733850129198966, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 18, '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': '3931982', 'n_tokens_mistral': 704, 'n_tokens_neox': 578, 'n_words': 137}