Skip to content

Commit

Permalink
Use Promise for delay directly
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyuan committed Feb 7, 2019
1 parent 17e9b20 commit 1e980bc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions examples/example.js
@@ -1,4 +1,3 @@
const PromiseA = require('bluebird');
const kvs = require('..');

const TTL = 100;
Expand Down Expand Up @@ -42,7 +41,7 @@ const store = kvs.store('memory');
})();

async function loadUser(id) {
await PromiseA.fromCallback(cb => setTimeout(cb, 100));
await new Promise(resolve => setTimeout(resolve, 100));
console.log("Returning user from slow database.");
return {id: id, name: 'Bob'};
}

0 comments on commit 1e980bc

Please sign in to comment.