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

fix(session tracker): fix synchronization of de-duplication code #756

Merged
merged 2 commits into from
Jul 17, 2020

Conversation

tomlongridge
Copy link
Contributor

@tomlongridge tomlongridge commented Jul 17, 2020

Goal

Fixes #750 - makes the list checking logic in session sending thread safe.

Changeset

  • Delivery/BugsnagSessionTrackingApiClient.m - used NSSet's containsObject rather than iterate ourselves and wrapped the list mutation in a synchronized block.
  • Delivery/BugsnagSessionTrackingApiClient.m - also updated the log message to show session ID rather than a count (as this is always 1 now)

Tests

Load-tested calling startSession across multiple threads:

    for (int i = 1; i <= 200; i++)
    {
        dispatch_queue_t _processingQueue = dispatch_queue_create("CrashReporting", DISPATCH_QUEUE_SERIAL);
        dispatch_async(_processingQueue, ^{
            [Bugsnag startSession];
        });
    }

@tomlongridge tomlongridge merged commit 5f01115 into next Jul 17, 2020
@tomlongridge tomlongridge deleted the tom/session-client-dedup-fix branch July 17, 2020 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants