Skip to content
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

Duplicate Upload with events not being cleared from local data store #170

Open
subbuthepeaceful opened this issue Aug 15, 2016 · 7 comments
Assignees

Comments

@subbuthepeaceful
Copy link

Details of Customer Keen IO Integration:

We are using Keen Library v3.5.5. We are not overriding keen.timestamp and are calling self.keenClient.uploadWithFinishedBlock when our app enters background mode.

Customer reports seeing duplicates around 25-35%. We can confirm that events with the exact same payload are being 'generated' twice i.e. with different values for keen.created_at.

This may be similar to Issue #156, but unsure whether uploadWithFinishedBlock is being called successively.

Opening the issue here so that we can collect more information in terms of trying to replicate the problem.

@subbuthepeaceful
Copy link
Author

subbuthepeaceful commented Aug 15, 2016

Code block provided:

Keen Upload

func uploadToDataKeen() {

  let application = UIApplication.sharedApplication()

  let backgroundTaskID = application.beginBackgroundTaskWithExpirationHandler { () -> Voidin

    print("Upload task for keen is expiring")

  }

  self.keenClient.uploadWithFinishedBlock { () -> Voidin

    application.endBackgroundTask(backgroundTaskID)

  }

}

And the function is called via Observer callback:

@objcprivatefunc didEnterBackground() {

  trackPotentialOldSavedSession()

  saveCurrentSession()

  uploadToDataKeen()

}

The observer is registered as follows:

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(TrackingService.didEnterBackground), name: UIApplicationDidEnterBackgroundNotification, object: nil)

@heitortsergent
Copy link
Contributor

@subbuthepeaceful thanks for sending the code snippets, I'm sorry this is happening. :(

Looking at the code, nothing comes to mind on why this may be happening... I'm going to take a closer look at this later today and update you here.

@subbuthepeaceful
Copy link
Author

Thank you very much @heitortsergent Please let me know if we can provide any additional information that would help diagnose

@heitortsergent
Copy link
Contributor

@subbuthepeaceful I still don't see anything in the code snippets that could be causing the error...

Could you please ask the customer the code block where they're calling the last line:

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(TrackingService.didEnterBackground), name: UIApplicationDidEnterBackgroundNotification, object: nil)

@schwmi
Copy link

schwmi commented Aug 17, 2016

Hi, @heitortsergent. We add this observer in the init of our TrackingService class. This class is a singleton and responsible for creating our keen events and calling the uploadWithFinishBlock method.

@heitortsergent heitortsergent self-assigned this Oct 31, 2016
@calhouncole
Copy link

Hi all,

Has there been any progress on this? I've been running into the same issues.

FYI, @schwmi @heitortsergent @subbuthepeaceful

@schwmi
Copy link

schwmi commented Dec 29, 2016

Hi, is there any news on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants