Skip to content

Commit

Permalink
fixed init of jackson lib
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakprabhakara committed Dec 13, 2024
1 parent fe6a74d commit b9ece90
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kustomize/overlays/demo/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ patches:

images:
- name: boxyhq/jackson
newTag: 1.34.1
newTag: 1.34.2
9 changes: 5 additions & 4 deletions lib/jackson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import '@lib/metrics';
const g = global as any;

export default async function init() {
if (!g.jacksonInstanceInit) {
g.jacksonInstanceInit = true;
g.jacksonInstance = await jackson(jacksonOptions);
if (!g.jacksonInstance) {
g.jacksonInstance = new Promise((resolve, reject) => {
jackson(jacksonOptions).then(resolve).catch(reject);
});
}

return g.jacksonInstance as SAMLJackson;
return (await g.jacksonInstance) as Promise<SAMLJackson>;
}
7 changes: 5 additions & 2 deletions npm/src/db/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ export default {
return g.__jacksonDb;
}

g.__jacksonDb = await _new(options);
return g.__jacksonDb;
g.__jacksonDb = new Promise((resolve, reject) => {
_new(options).then(resolve).catch(reject);
});

return await g.__jacksonDb;
},
};

0 comments on commit b9ece90

Please sign in to comment.