-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REPLAY-1963 Add background task coordinator #1412
REPLAY-1963 Add background task coordinator #1412
Conversation
Datadog ReportBranch report: ✅ |
DatadogCore/Sources/Core/Upload/BackgroundTaskCoordinator.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of using OS' background API is IMO good 👍. I noted few problems with the implementation.
168cb7f
to
7972ba6
Compare
25b8f89
to
abff044
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a question on cleanup.
DatadogCore/Sources/Core/Upload/BackgroundTaskCoordinator.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, it's simple and well abstracted 👏
I left some minor comments/suggestions
DatadogCore/Tests/Datadog/Core/Upload/DataUploadWorkerTests.swift
Outdated
Show resolved
Hide resolved
DatadogCore/Sources/Core/Upload/BackgroundTaskCoordinator.swift
Outdated
Show resolved
Hide resolved
DatadogCore/Sources/Core/Upload/BackgroundTaskCoordinator.swift
Outdated
Show resolved
Hide resolved
DatadogCore/Tests/Datadog/Core/Upload/DataUploadWorkerTests.swift
Outdated
Show resolved
Hide resolved
abff044
to
51231a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok 👍.
What about observability of batches that are sent (deleted) while the app is in background? The metrics we added recently include is_background
attribute that was made for this. Do we have task to cover it?
DatadogCore/Sources/Core/Upload/BackgroundTaskCoordinator.swift
Outdated
Show resolved
Hide resolved
51231a1
to
ca19162
Compare
Datadog ReportBranch report: ✅ |
DatadogCore/Sources/Core/Upload/BackgroundTaskCoordinator.swift
Outdated
Show resolved
Hide resolved
b536b3e
to
1075eed
Compare
43bd9f4
to
79785d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG in overall 👌. I left few small change requests, no major blockers.
What and why?
Adds
BackgroundTaskCoordinator
which is abstraction that allows creatingUIBackgroundTask
if UIKit is available.This is utilised in
DataUploadWorker
to register background tasks for upload works.With this change we receive additional 30 seconds of upload time after app goes to background.
It's a starting point for other uploader improvements that will be explained in the RFC.
Review checklist
Custom CI job configuration (optional)