Skip to content

Commit

Permalink
async json stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
bcollard committed Feb 12, 2024
1 parent 3d0da0a commit b3f1010
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/app/postgresql.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pool.on("error", (err, clients) => {
});

const search = async (itemName) => {
// await logger.info('pool details: ' + JSON.stringify(pool));
const poolDetails = await asyncStringify(pool);
await logger.info('pool details: ' + poolDetails);
await dnsPromises.lookup(pool.options.host, dnsOptions).then(async (result) => {
await logger.info('DNS lookup for host ' + pool.options.host + ': %j', result);
});
Expand Down Expand Up @@ -66,6 +67,12 @@ const importData = () => {
})().catch((e) => logger.error(e.stack));
};

function asyncStringify(str) {
return new Promise((resolve, reject) => {
resolve(JSON.stringify(str));
});
}

module.exports = Object.assign({
search,
importData,
Expand Down

0 comments on commit b3f1010

Please sign in to comment.