Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Recommended Posts

Posted

Hi,

 

the code below returns a code 500 response when run in ZeroBrane; on HC3, it simply crashes. I suspect it's a timeout issue, the server can take between 5 and 12 seconds to respond. How can I increase the timeout to say 15 seconds?

 

Please login or register to see this code.

 

Output on ZeroBrane suggests timeout after two seconds

Please login or register to see this code.

 

Two example respone time measurements

Please login or register to see this code.

 

Thanks for your suggestions!

  • Topic Author
  • Posted

    Fixed, found a way to speed up the server. Would stil be interested to know if the timeout in request() can be increased.

    Posted

    Like this:

     

    1
    2
    3
    function QuickApp:onInit()
        self.http = net.HTTPClient({timeout=3000})
    end
    Posted

    Well, 500 is "internal server error", and can be whatever. So, the 500 code is returned from the server.

    If the http request doesn't don't get a response within x seconds the http code will return the 'timeout' (because the server didn't answer).

    The default timeout is more than 2s, so I suspect there is something else going on...

  • Topic Author
  • Posted
    3 hours ago, jgab said:

    Well, 500 is "internal server error", and can be whatever. So, the 500 code is returned from the server.

    If the http request doesn't don't get a response within x seconds the http code will return the 'timeout' (because the server didn't answer).

    The default timeout is more than 2s, so I suspect there is something else going on...

    Thanks both for your answers

     

    Well yes, the timeout is just a theory. It's just strange that curl works and the lua function doesn't. And I never sae curl coming back with a 500 error.

     

    Anyway I changed the server logic to make it respond more quickly (by polling the value separately), and now it is miraculously solved. But I agree: I don't think I understood yet what was going on in the first place.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...