Giter Site home page Giter Site logo

Comments (4)

crleona avatar crleona commented on September 25, 2024 1

Thanks @mt00chikin - I believe this is fixed by #159 which should release later this week.

from amplitude-swift.

crleona avatar crleona commented on September 25, 2024

Hi @mt00chikin, The stack trace points to a crash calling dispatch.sync on one of our internal queues, which probably indicates a deadlock. Could you share more information about how you are calling ApplicationAnalyticsService.identifyIfNeeded (in terms of dispatch), as shown in the background thread in the stack trace?

from amplitude-swift.

mt00chikin avatar mt00chikin commented on September 25, 2024

Sure thing. That service manages multiple different analytics destinations, Amplitude being one of several, and on any analytics event publish(_:) call it first checks several user properties to ensure that the user's context hasn't changed since the last event was fired. If it has, it then calls identify on each downstream service. In our case, it calls Amplitude's public func identify(identify: Identify, options: EventOptions? = nil) -> Amplitude function. Once that's done, it proceeds to publish the event using amplitude.track().

This is all happening on an internal serial DispatchQueue.

// ApplicationAnalyticsService.swift 

func publish(_ event: SubwayEvent) {
    eventQueue.async { [weak self] in
        guard let self else { return }
        ...
        publish(event)
    }
} 

private func publish(_ event: AnalyticEvent) {
    identifyIfNeeded()
    // Publish on each downstream service
    services.forEach { $0.publish(event) }
}

private func identifyIfNeeded() {
    guard let userIdentity = contextCache?.currentUserIdentity() else { return }

    // If identity did not change there's no need to re-identify the user.
    guard userIdentity != currentUserIdentity else { return }
    services.forEach { $0.identify(userIdentity) }
    currentUserIdentity = userIdentity
}

from amplitude-swift.

crleona avatar crleona commented on September 25, 2024

This should be fixed in 1.5.0.

from amplitude-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.