[Lazarus] fpWeb long process progress

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Aug 14 09:06:20 CEST 2012



On Mon, 13 Aug 2012, Leonardo M. Ramé wrote:

> On 2012-08-13 15:15:56 -0700, leledumbo wrote:
>>> How can I send responses by intervals?
>>
>> AFAIK that's not the way web application works. It's the client that should
>> be querying the server in a regular interval (using AJAX request perhaps).
>> The server can track current progress status and return that right away when
>> asked.
>>
>
> Yes, I know that, but I thought Lazarus have something easy to develop
> such process.
>
> The way I'm thinking of implementing is this:
>
> 1) The client app asks the server (a CGI process) for a process ID, for
> example 123, by calling getProcId.
> 2) Using this ID, the client calls the time-consuming task, passing the
> ID. for example, runTask(Id). At this time, the server launches a
> program passing the ID for the task. This must be a multi-thread
> program, because it can be asked for running many tasks, and can be
> asked for the status of each task. The program only finishes when the
> last task is ended.
> 3) The client calss a getProcStatus(ID) method. The server, using IPC or
> Pipes, asks the already-launched process for its status.

I have code which does exactly that. It's used in production. 
It's unix-only, however (it relies on fork and exec).

If you're interested, I can send you the code.

Michael.


More information about the Lazarus mailing list