File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
content/develop/clients/nodejs Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -152,3 +152,29 @@ const updatedPath = await client.get('shellpath');
152
152
console .log (updatedPath);
153
153
// >>> /usr/syscmds/:/usr/mycmds/
154
154
```
155
+
156
+ In an environment where multiple concurrent requests are sharing a connection
157
+ (such as a web server), you must wrap the above transaction logic in a call to
158
+ ` client.executeIsolated ` to get an isolated connection, like so:
159
+
160
+ ``` js
161
+ await client .executeIsolated (async (client ) => {
162
+ await client .watch (' shellpath' );
163
+ // ...
164
+ })
165
+ ```
166
+
167
+ This is important because the server tracks the state of the WATCH on a
168
+ per-connection basis, and concurrent WATCH and MULTI/EXEC calls on the same
169
+ connection will interfere with one another.
170
+
171
+ You can configure the size of the isolation pool when calling ` createClient ` :
172
+
173
+ ``` js
174
+ const client = createClient ({
175
+ isolationPoolOptions: {
176
+ min: 1 ,
177
+ max: 100 ,
178
+ },
179
+ })
180
+ ```
You can’t perform that action at this time.
0 commit comments