Skip to content

Commit

Permalink
chore(docs): update images
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsasharegan committed Mar 29, 2018
1 parent 6b1e0b3 commit b3f0d69
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
.*
!.gitignore
!.prettierrc
!.prettierignore
!.travis.yml
!.coveralls.yml
node_modules/
Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
@@ -0,0 +1,4 @@
CHANGELOG.md
package*.json
lib
node_modules
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -23,10 +23,10 @@ back in the pool.

Note that the factory function implements an equal jitter exponential backoff for retrying resource creation.

![pooler interface](./docs/pooler-interface.1.png)
![pooler interface](./docs/pooler-interface.2.png)

## Basic Usage

To get started, created a pooler from the implementation's option object.

![basic usage with database](./docs/db-basic.1.png)
![basic usage with database](./docs/db-basic.2.png)
Binary file removed docs/db-basic.1.png
Binary file not shown.
Binary file added docs/db-basic.2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 7 additions & 17 deletions docs/example.db.js
@@ -1,33 +1,23 @@
import * as r from "rethinkdb";
import { NewPooler } from "pooler";
import { NewPooler } from "../lib";

const config = {
const pool = NewPooler({
max: 10, // default
min: 3, // default
max_retries: 3, // default
buffer_on_start: true, // default
timeout: 250, // default
timeout_cap: 30000, // default
async factory() {
return await r.connect("localhost:8080");
},
async destructor(conn) {
await conn.close();
},
async is_ok(conn) {
if (!conn.open) {
return false;
}

try {
await conn.ping();
} catch (error) {
return false;
}

return true;
is_ok_sync(conn) {
return conn.open;
},
};

const pool = NewPooler(config);
});

app.get("/products", async (req, res) => {
pool.use(async conn => {
Expand Down
Binary file removed docs/pooler-interface.1.png
Binary file not shown.
Binary file added docs/pooler-interface.2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b3f0d69

Please sign in to comment.