How to use the threads/observable.Subject function in threads

To help you get started, we’ve selected a few threads examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ArkEcosystem / core / packages / core-transaction-pool / src / worker / worker.ts View on Github external
public constructor() {
        this.results = new Subject();

        this.queue = async.queue(({ job }: { job: IQueuedTransactionJob }, cb) => {
            delay(1)
                .then(() => {
                    try {
                        return this.processTransactions(job, cb);
                    } catch (error) {
                        console.log(error.stack);
                        return cb();
                    }
                })
                .catch(error => {
                    console.log(error.stack);
                    return cb();
                });
        });