You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 29, 2021. It is now read-only.
@justindarc I am thinking of working on this next.
It appears straightforward to wrap the entire lib to run on a single concurrent background queue (no big refactor is needed to do this that I can see). I see it as changing the thread it runs on from main to off-main.
The lib only has these public access functions which need to have guarded memory access:
Telemetry.default and Telemetry.init() [actually, init functions don't need any changes]
Telemetry.add()
Telemetry.recordEvent()
Telemetry.configuration
Everything else in Telemetry.swift can be internal access level AFAIK.
I don't see any issues with avoiding shared mem access in those functions, add() and recordEvent() could post an immutable object to the background queue. Telemetry.configuration could be changed to a struct and internally accessed only through a getter that returns an immutable copy (and a setter that takes immutable input).
I'll put up a gist to show what I am thinking (and I need to try this hands-on for a bit to better understand this myself).
A single non-concurrent background thread for disk management is a common pattern to use here.
Lends itself well to rate-limiting the I/O.
The text was updated successfully, but these errors were encountered: