From 3b4d090fab7dd028a45d8ed12b02837919106084 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 29 Aug 2024 23:09:29 +0200 Subject: [PATCH] docs(README.md): use top level await syntax in example MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c5d78d14..c2260208 100644 --- a/README.md +++ b/README.md @@ -138,14 +138,12 @@ pool.emitter?.on(PoolEvents.busy, () => console.info('Pool is busy')) // the execute method signature is the same for both implementations, // so you can easily switch from one to another -pool - .execute() - .then(res => { - console.info(res) - }) - .catch(err => { - console.error(err) - }) +try { + const res = await pool.execute() + console.info(res) +} catch (err) { + console.error(err) +} ``` You can do the same with the classes _ClusterWorker_, _FixedClusterPool_ and _DynamicClusterPool_. -- 2.34.1