frajk
frajk

Reputation: 863

GAE Request Timeout when user uploads csv file and receives new csv file as response

I have an app on GAE that takes csv input from a web form and stores it to a blob, does some stuff to obtain new information using input from the csv file, then uses csv.writer on self.response.out to write a new csv file and prompt the user to download it. It works well, but my problem is if it takes over 60 seconds it times out. I've tried to setup the do some stuff part as a task in task queue, and it would work, except I can't make the user wait while this is running, and there's no way of calling the post that would write out the new csv file automatically when the task queue is complete, and having the user periodically push a button to see if it is done is less than optimal.

Is there a better solution to a problem like this other than using the task queue and having the user have to manually push a button periodically to see if the task is complete?

Upvotes: 0

Views: 102

Answers (2)

pgiecek
pgiecek

Reputation: 8220

If your problem is 60s limit for requests, you could consider to use App Engine Modules that allow you to control scaling type of a module/version. Basically there are three scaling types available.

Manual Scaling

Such a module runs continuously. Requests can run indefinitely.

Basic Scaling

Such a module creates an instance when the application receives a request. The instance will be turned down when the app becomes idle. Requests can run indefinitely.

Automatic Scaling

The same scaling policy that App Engine has used since its inception. It is based on request rate, response latencies, and other application metrics. There is 60-second deadline for HTTP requests.

You can find more details here.

Upvotes: 0

Andrei Volgin
Andrei Volgin

Reputation: 41099

You have many options:

  1. Use a timer in your client to check periodically (i.e. every 15 seconds) if the file is ready. This is the simplest option that requires only a few lines of code.

  2. Use the Channel API. It's elegant, but it's an overkill unless you face similar problems frequently.

  3. Email the results to the user.

Upvotes: 2

Related Questions