Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:16:29+00:00 2026-05-26T04:16:29+00:00

I’m a rank beginner with Ruby and Sinatra, but have managed to come up

  • 0

I’m a rank beginner with Ruby and Sinatra, but have managed to come up with a web service that works pretty well, running on Heroku. I access this web service from Salesforce.com.

The HTTPRequest class that I use in Salesforce/Apex has a maximum timeout of 60s. If I hit that timeout (or, when I hit a 1 second timeout I’m using for testing purposes), I get an exception on the Salesforce side, which I can easily handle. What I’m interested in is how to handle this on the Sinatra side.

If my client gets a timeout, and somehow closes the connection, is there a way to “sense” this in my Sintra app? I’d like to note client timeout, continue doing the work the app had started, and then send an email to let the user know the job had finished after the timeout.

I should note that when I do get the timeout now, the Sinatra app happily finishes what it was doing, and, I’m guessing, returns the JSON data that it is supposed to. Only there’s nothing on the client side to get that data.

Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:16:30+00:00Added an answer on May 26, 2026 at 4:16 am

    Fun problem. As a stateless protocol, I do not believe HTTP includes a method of “sensing” when a client closes a connection. I really don’t know anything about what SalesForce does, but here’s some standard HTTP solutions (I’m assuming Web Sockets are out).

    Easiest, but prone to false positives

    Since you know the max timeout, time your Sinatra request. If it took longer than 60 sec, assume it timed out and send an email. Obviously this is prone to error anywhere around 59-61 seconds, and you may get some false positives and false negatives.

    Harder, but prone to perfection

    You could implement a “read receipt.” Your JSON response would include a UID. If your SalesForce request doesn’t timeout, send the UID back as a receipt. Then Sinatra would know everything was okay.

    If the Sinatra app doesn’t receive the receipt within n seconds/minutes (because SalesForce timed out and you never got the UID), the Sinatra app could send an email (or whatever) after n seconds/minutes.

    This could be implemented several ways. The simplest probably involves a database, a script, and cron. The most difficult probably involves HTTP streaming (now trivial in Sinatra 1.3) and possibly multi-threaded or evented servers like Thin or Zbattery. I’d be happy to elaborate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.