Skip to content

Commit

Permalink
documentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
henryfauna committed Jun 14, 2022
1 parent 0fc1a61 commit fcc1d22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,14 @@ have been resolved, the client will keep the session open for a period of time
(500ms by default) to be reused for any new requests.

The `http2SessionIdleTime` parameter may be used to control how long the HTTP/2
session remains open while the connection is idle. To save on the overhead of
session remains open while the query connection is idle. To save on the overhead of
closing and re-opening the session, set `http2SessionIdleTime` to a longer time.
The default value is 500ms and the maximum value is 5000ms.

While an HTTP/2 session is alive, the client will hold the Node.js event loop
Note that `http2SessionIdleTime` has no effect on a stream connection: a stream
is a long-lived connection that is intended to be held open indefinitely.

While an HTTP/2 session is alive, the client holds the Node.js event loop
open; this prevents the process from terminating. Call `Client#close` to manually
close the session and allow the process to terminate. This is particularly
important if `http2SessionIdleTime` is long:
Expand All @@ -298,15 +301,13 @@ const { Client, query: Q } = require('faunadb')
async function main() {
const client = new Client({
secret: 'YOUR_FAUNADB_SECRET',
http2SessionIdleTime: 1000,
// ^^^ Non-negative integer
http2SessionIdleTime: 1000, // Must be a non-negative integer
})
const output = await client.query(Q.Add(1, 1))

console.log(output)

client.close()
// ^^^ If it's not called then the process won't terminate
}

main().catch(console.error)
Expand Down
4 changes: 2 additions & 2 deletions src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ var values = require('./values')
* @param {?number} options.http2SessionIdleTime
* Sets the maximum amount of time (in milliseconds) an HTTP2 session may live
* when there's no activity. Must be a non-negative integer, with a maximum value of 5000.
* If an invalid value is passed a default of 500 ms will be applied. If a value
* exceeding 5000 ms is passed (e.g. Infinity) the maximum of 5000 ms will be applied.
* If an invalid value is passed a default of 500 ms is applied. If a value
* exceeding 5000 ms is passed (e.g. Infinity) the maximum of 5000 ms is applied.
* Only applicable for NodeJS environment (when http2 module is used).
* can also be configured via the FAUNADB_HTTP2_SESSION_IDLE_TIME environment variable
* which has the highest priority and overrides the option passed into the Client constructor.
Expand Down

0 comments on commit fcc1d22

Please sign in to comment.