Skip to content

Commit 95aeceb

Browse files
feat: bg instrumentation
1 parent 6f17549 commit 95aeceb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Agent/General/NewRelicAgentInternal.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ - (void) scheduleHeartbeatTask {
783783
if (@available(iOS 13.0, *)) {
784784
// TODO: Pass instrumented app bundle id
785785
BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:@"com.newrelic.NRApp.bitcode"];
786-
request.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:5 * 60];
786+
request.earliestBeginDate = nil;//[NSDate dateWithTimeIntervalSinceNow:5 * 60];
787787

788788
NSError *error = nil;
789789

@@ -806,13 +806,16 @@ - (void) handleAppRefreshTask:(BGAppRefreshTask *)task {
806806
NRLOG_VERBOSE(@"handleAppRefreshTask BGAppRefreshTask");
807807
if (@available(iOS 13.0, *)) {
808808

809+
// We always reschedule the heartbeat task.
810+
[self scheduleHeartbeatTask];
811+
809812
[task setExpirationHandler:^{
810813
__weak BGTask *weakTask = task;
811814
if (weakTask) {
812815
[weakTask setTaskCompletedWithSuccess:false];
813816
}
814817
//TODO: Invalidate and cancel the harvest request
815-
// PokeManager.urlSession.invalidateAndCancel()
818+
// weakTask.invalidateAndCancel()
816819

817820
}];
818821

@@ -821,8 +824,6 @@ - (void) handleAppRefreshTask:(BGAppRefreshTask *)task {
821824
// TODO: Make sure this is the right place to call this.
822825
[task setTaskCompletedWithSuccess:true];
823826

824-
// We always reschedule the heartbeat task.
825-
[self scheduleHeartbeatTask];
826827
}
827828
else {
828829
NRLOG_VERBOSE(@"No background tasks pre iOS 13");

0 commit comments

Comments
 (0)