Skip to content

analytics.track() - asynchronous #65

@patillacode

Description

@patillacode

Hi there,

I have been working with Segment's analytics-python module for a little while now.

Today I discovered that for example the track method is asynchronous.
I never realized this before, since I usually use it within services that are always up (listeners, queues, etc)

Today I had to do a simple script to read from a file and push some data into my Segment bucket. Surprisingly when I run the super simple script the data didn't get to my Segment debugger, although when I ran the same exact code in a python console it worked like a charm.

I finally saw the problem was that my script finished before the analytics.track() function was done.
I added an extra 10 seconds to wait for it to be executed and I made sure that was the problem indeed.

So, is there anyway to make the track method wait for itself? Any extra args I could put in?
Callbacks? Any suggestions?

I took sometime to go through all the options I didn't figure out a way to do it,
any help is greatly appreciated.

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions