Skip to content

Bug: batch set #47

@willin

Description

@willin
import hostile from 'hostile';
import { promisify } from 'util';

const hostileSet = promisify(hostile.set);

Promise.all([
  hostileSet('1.2.3.4', 'test1'),
  hostileSet('1.2.3.5', 'test2'),
  hostileSet('1.2.3.4', 'test1'),
  hostileSet('1.2.3.4', 'test3')
]).then(console.log);
// [ undefined, undefined, undefined, undefined ]

in host file:

1.2.3.4 test1

only add one line


import hostile from 'hostile';
import sleep from 'sleep-promise';
import { promisify } from 'util';

const hostileSet = promisify(hostile.set);

Promise.all([
  (async () => {
    await sleep(200);
    await hostileSet('1.2.3.4', 'test1');
  })(),
  (async () => {
    await sleep(200);
    await hostileSet('1.2.3.5', 'test2');
  })(),
  (async () => {
    await sleep(200);
    await hostileSet('1.2.3.4', 'test1');
  })(),
  (async () => {
    await sleep(200);
    await hostileSet('1.2.3.4', 'test3');
  })()
]).then(console.log);
// [ undefined, undefined, undefined, undefined ]

in host file:

1.2.3.4 test1

only add one line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions