Timeout setting is not being Accepted #183

Closed
jcua opened this Issue Sep 25, 2012 · 3 comments

Comments

Projects
None yet
4 participants

jcua commented Sep 25, 2012

In the Raven 2.0.3 docs, there is a parameter called 'timeout'. But when I tried to set this value, the raven client is not accepting it.

I am setting the timeout like this.

client = Client(
  servers=['http://sentry.local/api/store/'],
  public_key='public_key',
  secret_key='secret_key',
  project=1, 
  timeout=10,

)

And if I look at raven/base.py, I see this which seems to suggest that the timeout parameter cannot be set in the above config.

if kwargs.get('timeout') is not None:
        warnings.warn('The ``timeout`` option no longer does anything. Pass the option to your transport instead.')

And I tried to pass this config in the transport (I did something like this on the dsn) and it does not work as well...

http://xxx:yyy@sentry.server.url/project_id?timeout=10

But if I change raven/conf/defaults.py (TIMEOUT), raven accepts this change.

my understanding of the code is that if you add ?timeout=10 on the server url in the example above it will work.

the problem is when using raven with Django. RAVEN_CONFIG['timeout'] is ignored and if you add the timeout to the dsn as above, that gets stripped out by the time it ends up in the servers list and thus the url given to TransportRegistry:get_transport().

vls commented Mar 14, 2013

class HTTPTransport(Transport):

    scheme = ['http', 'https']

    def __init__(self, parsed_url, timeout=defaults.TIMEOUT):

In raven/transport/base.py, transport object take defaults.TIMEOUT as default function parameter. Change defaults.TIMEOUT will not effect HTTPTransport().timeout. There is no way in user's code to change the timeout.

Consider the following code:

#foo.py

TIMEOUT = 1

def bar(v=TIMEOUT):
    print TIMEOUT
    print v

#test.py
#!/usr/bin/env python
import foo
foo.TIMEOUT = 2

foo.bar()

result will be
2
1

Contributor

xordoquy commented Jul 23, 2013

This issue will be followed in #253 as the timeout parameter seems broken at the moment.

@xordoquy xordoquy closed this Jul 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment