Merge pull request #4168 from overleaf/jpa-service-worker-version

[misc] serviceWorker: add version to metrics for tracking changes

GitOrigin-RevId: 1c05aea2f578fe171dd02330ec7f76f18f02ff65
This commit is contained in:
Jakob Ackermann 2021-06-10 12:02:06 +02:00 committed by Copybot
parent 10e7a919c0
commit afd79f63ec

View file

@ -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,