We've just realized that Electron locks the IndexedDB database when it's opened, so multiple processes cannot access it concurrently (which makes a lot of sense 😅). This causes issues when using multiple versions of Atom at the same time, since the Electron folder (which is where the IndexedDB files are stored) is common between versions.
When this happens, IndexedDB.open() throws an error, which we're currently not handling so it appears on the development console (the exception actually appears each time an event is logged, since we're awaiting the resulting promise from IndexedDB.open() for each event).
Solution
This PR consists of two commits:
The first one takes care of handling the IndexedDB exceptions and converting all the methods to store/retrieve metrics into noops, so no more exceptions are shown in console.
The second commit goes a step further, and takes advantage of the new generic way of creating stores for telemetry to create an in-memory storage class that is used as a fallback whenever the IndexedDB database is not available.
Thanks to this, if for some reason we can't operate with the IndexedDb, metrics will still get generated and reported (but not persisted between sessions).
Context
We've just realized that Electron locks the
IndexedDB
database when it's opened, so multiple processes cannot access it concurrently (which makes a lot of sense 😅). This causes issues when using multiple versions of Atom at the same time, since the Electron folder (which is where theIndexedDB
files are stored) is common between versions.When this happens,
IndexedDB.open()
throws an error, which we're currently not handling so it appears on the development console (the exception actually appears each time an event is logged, since we're awaiting the resulting promise fromIndexedDB.open()
for each event).Solution
This PR consists of two commits:
IndexedDB
exceptions and converting all the methods to store/retrieve metrics into noops, so no more exceptions are shown inconsole
.telemetry
to create an in-memory storage class that is used as a fallback whenever theIndexedDB
database is not available.Thanks to this, if for some reason we can't operate with the
IndexedDb
, metrics will still get generated and reported (but not persisted between sessions).