keolo / mixpanel_client

Ruby interface to the Mixpanel Data API
MIT License
148 stars 72 forks source link

'Uninitalized Constant Typhoeus' with parallel execution #38

Closed lynchd closed 10 years ago

lynchd commented 10 years ago

I caught a bug while running parallel requests on a Gem cloned and built manually from master

/usr/local/share/gems1.9/gems/mixpanel_client-4.0.1/lib/mixpanel/client.rb:100:in prepare_parallel_request': uninitialized constant Typhoeus (NameError)
    from /usr/local/share/gems1.9/gems/mixpanel_client-4.0.1/lib/mixpanel/client.rb:59:in `make_parallel_request'
    from /usr/local/share/gems1.9/gems/mixpanel_client-4.0.1/lib/mixpanel/client.rb:55:in `request'
    from mixpanel-client.rb:19:in `execute'
    from mixpanel-client.rb:63:in `block (2 levels) in <main>'
    from mixpanel-client.rb:61:in `each'
    from mixpanel-client.rb:61:in `block in <main>'
    from mixpanel-client.rb:52:in `each'
    from mixpanel-client.rb:52:in `<main>'

my Ruby Version is

ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

It looks like client.rb might need to require typhoeus by some means. The workaround I have was to install the typhoeus gem and require it manually from my client script.

require 'mixpanel_client'
require 'typhoeus'

I'll fork and have a look at patching shortly.

Thanks!

keolo commented 10 years ago

Thanks for reporting the issue. Hmm maybe a require 'typhoeus' in Mixpanel#make_parallel_requests would work?

keolo commented 10 years ago

Okay. I added the require in the latest version 4.1.0. Let me know if that works.

lynchd commented 10 years ago

Sorry I didn't get around to submitting a patch, I'll close this and let you know how I get on. Thanks

keolo commented 10 years ago

No worries. It was an easy enough fix. Thanks.