Immediate -> timeout (#14)

This commit is contained in:
Dima 2021-02-02 14:13:52 +03:00 committed by GitHub
parent 4276ea7c2e
commit e4d3f688ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@fluencelabs/fluence",
"version": "0.9.3",
"version": "0.9.9",
"description": "JS SDK for the Fluence network",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",

View File

@ -1,6 +1,6 @@
import { FluenceClient } from './FluenceClient';
import { SecurityTetraplet } from './internal/commonTypes';
import { genUUID, Particle } from './internal/particle';
import { Particle } from './internal/particle';
import Multiaddr from 'multiaddr';
import PeerId, { isPeerId } from 'peer-id';
import { generatePeerId, seedToPeerId } from './internal/peerIdUtils';
@ -106,9 +106,9 @@ export const subscribeToEvent = (
): Function => {
const realHandler = (args: any[], tetraplets: SecurityTetraplet[][]) => {
// dont' block
setImmediate(() => {
setTimeout(() => {
handler(args, tetraplets);
});
}, 0);
return {};
};

View File

@ -138,10 +138,10 @@ export class FluenceClientImpl extends FluenceClientBase implements FluenceClien
const executingParticlePromiseFns = this.fetchParticles.get(fnName);
if (executingParticlePromiseFns) {
// don't block
setImmediate(() => {
setTimeout(() => {
this.fetchParticles.delete(fnName);
executingParticlePromiseFns.resolve(args);
});
}, 0);
}
return {
@ -170,12 +170,12 @@ export class FluenceClientImpl extends FluenceClientBase implements FluenceClien
}
// don't block
setImmediate(() => {
setTimeout(() => {
this.pushEvent(serviceId, {
type: fnName,
args: args,
});
});
}, 0);
return {
ret_code: 0,