From afd79f63ec2967238354a0161f9c721c2eb65a4c Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 10 Jun 2021 12:02:06 +0200 Subject: [PATCH] Merge pull request #4168 from overleaf/jpa-service-worker-version [misc] serviceWorker: add version to metrics for tracking changes GitOrigin-RevId: 1c05aea2f578fe171dd02330ec7f76f18f02ff65 --- services/web/frontend/js/serviceWorker.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/web/frontend/js/serviceWorker.js b/services/web/frontend/js/serviceWorker.js index 78a8d482fd..2ae2c12ad0 100644 --- a/services/web/frontend/js/serviceWorker.js +++ b/services/web/frontend/js/serviceWorker.js @@ -1,6 +1,10 @@ import { v4 as uuid } from 'uuid' const OError = require('@overleaf/o-error') +// VERSION should get incremented when making changes to caching behavior or +// adjusting metrics collection. +const VERSION = 1 + const COMPILE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/compile$/ const PDF_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/.*\/output.pdf$/ const PDF_JS_CHUNK_SIZE = 128 * 1024 @@ -21,6 +25,7 @@ function getClientContext(clientId) { if (!clientContext) { const pdfs = new Map() const metrics = { + version: VERSION, id: uuid(), epoch: Date.now(), cachedBytes: 0,