From 3b9bb94b3e53180e1fc73729c609b4dceb757bdd Mon Sep 17 00:00:00 2001 From: Joshua Miller Date: Sat, 25 Mar 2023 21:05:49 -0500 Subject: [PATCH] :bulb: Report total time on full sync --- src/handlers/syncAll.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/handlers/syncAll.ts b/src/handlers/syncAll.ts index 2c83e82..e8a284e 100644 --- a/src/handlers/syncAll.ts +++ b/src/handlers/syncAll.ts @@ -8,6 +8,8 @@ export async function syncAllHandler( _req: Request, res: Response ) { + const start = Date.now(); + const client = GetClient(); const installations = await client.GetInstallations(); @@ -24,5 +26,12 @@ export async function syncAllHandler( const results = await Promise.all(orgSyncPromises); - return res.status(200).json(results); + const end = Date.now(); + + const resultObject = { + orgSyncResults: results, + timeToCompleteInMilliseconds: end - start + } + + return res.status(200).json(resultObject); } \ No newline at end of file