Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
fix: await the creation of the database if missing (#95)
Browse files Browse the repository at this point in the history
* fix: await the creation of the database if missing

This fixes a race condition where the db doesn't exist if someone uses rethinkdb manually too

* misc: Do requested changes

* Update rethinkdb.js
  • Loading branch information
vladfrangu authored and kyranet committed Aug 28, 2018
1 parent 5b36dfc commit 8ec7e1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion providers/rethinkdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = class extends Provider {

async init() {
const { db } = this.db._poolMaster._options;
return this.db.branch(this.db.dbList().contains(db), null, this.db.dbCreate(db));
await this.db.branch(this.db.dbList().contains(db), null, this.db.dbCreate(db)).run();
}

get exec() {
Expand Down

0 comments on commit 8ec7e1f

Please sign in to comment.