Closed ddaddy closed 3 years ago
Hi Darren.
this looks really good! I'm reading through the code and nodding my head.
One question though: You're copying the ClientTester application into the repository, and I assume that is to directly test the client without having to do the package dance, but I can't get it to work? I was expecting an xcproj file or something, but there's just a Package.swift
and it doesn't seem to define a target.
Is this an oversight on your part, or am I just not getting how to use it?
There should definitely be an xcode proj file. Maybe it didn't check in. Just out watching the football (Come on England 😬). I'll check it later or in the morning.
🥳
The .gitignore
that the project had, ignored the Xcode project file. It should be added now.
Okay, so it looks really good! I just updated the server to accept up to 1MB post requests on that endpoint, so I think we can accept larger numbers of signals at once. I'm going to play around with it a little more :)
Great. 100 should be easily achievable and within 10 seconds should be fine. It'll only really hit the limit when the app is used without an internet connection and all signals cached.
This all works really well in my tests! Thank you very much! I'm going to merge it and layer some docs on top!
Ok, so there's a lot going on here.
I've added your local caching but fixed a few bugs. I also made it generic and not specific to
SignalPostBody
as was suggested on Twitter. The cache will load any previously unsent signals from disk on initialisation. I've refactored theSignalPayload
into it's own struct. There's a newSignalManager
that handles the cache, timer etc..SignalManager
will send a new batch of signals every 10 seconds and also once at startup (If any previous signals exist) Signals are sent in batches of 25. Attempting with 50 sometimes resulted in aPayload Too Large
error. There's no mitigation if sending 25 gives this error, so maybe increase the payload size server side just to make sure. If signals fail to send, they will be added back to the queue, so if aPayload Too Large
error does occur, they will always be stuck in the cache.The cache is saved to disk at different points depending on device/os:
There is a new
showDebugLogs
option on theTelemetryManagerConfiguration
that will show very detailed logs of everything in action.There are 4 new targets added to the project that I have thoroughly tested:
You will notice that in the Xcode project there is a separate framework target for
watchOS
. This is necessary because building forwatchOS
builds both theiOS
andwatchOS
targets and results in errors trying to add theiOS
framework into awatchOS
target. This is purely for the sample targets and shouldn't affect how theSPM
package is delivered and built. (Someone else may be able to fix it to use the 1 framework 🤷♂️)I have not updated the
README