zevarito / mixpanel

Simple lib to track events in Mixpanel service. It can be used in any rack based framework.
MIT License
273 stars 84 forks source link

Track events weren't being sent asynchronously #116

Closed ericboehs closed 11 years ago

ericboehs commented 11 years ago

Since options[:async] is usually nil and because we aren't merging defaults on to options (as we are in person.rb), options[:async] was nil and causing events to be tracked synchronously.

ericboehs commented 11 years ago

I am sorry @ericboehs I cannot appreciate the needed of this change.

Come again? Are you saying this change isn't needed? Or very needed?

If the latter, when do you plan on merging?

Thanks!

ericboehs commented 11 years ago

I think you mean the former, so let me explain further:

When one calls track_event they rarely pass options[:async] to it because they'd have to do this all over their code. They usually set it when the Tracker class is instantiated which is where @async gets its value.

The request method never checks @async, it only checks an async property which is passed to it.

Since default isn't merged onto options, as it is in person.rb, options[:async] never gets set and the ternary in request is always false (unless you passed options[:async] on every track_event).

zevarito commented 11 years ago

My bad. Have looked at it so quick that missed it. I'll merge it EOD.

zevarito commented 11 years ago

4.0.5 is available. sorry for the confusion.