Skip to content

Commit 13dcdaf

Browse files
authored
fix: check if there is an existing namespace before creating one
1 parent b141fd3 commit 13dcdaf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const cls = require('cls-hooked');
44

55
const nsid = 'a6a29a6f-6747-4b5f-b99f-07ee96e32f88';
6-
const ns = cls.createNamespace(nsid);
6+
const ns = cls.getNamespace(nsid) || cls.createNamespace(nsid);
77

88
/** Express.js middleware that is responsible for initializing the context for each request. */
99
function middleware(req, res, next) {

0 commit comments

Comments
 (0)