You are not logged in.
Pages: 1
Hi, thanks for the great work and sorry for my English.
I need to implement server object with very expensive (time consuming) creation, wich i suppose to reuse from call to call. Also its not thread safe, so I believe the sicPerThread creation model is suitable.
I also need a client for this server implemented in Delphi 7.
I encountered two issues:
a) The KeepAliveTimeout is hardcoded to 30 sec in module mormot.rest.http.server:
fHttpServer := HTTPSERVERSOCKETCLASS[aUse].Create(fPort, HttpThreadStart, HttpThreadTerminate, TrimU(fRestServerNames), aThreadPoolCount, 30000, hso)
Session terminates and destroys my object after 30 sec while i need something about one-two hours. Maybe I'm doing something wrong? Why hardcode?
b) Client compiled with Delphi 7 terminates the previous session for each call (while the same code, compiled with Delphi 10.4 works fine).
Do you have any suggestions to achieve my goals?
Thank You.
Offline
The sicPerThread is not what you need. This option will just map the HTTP connection threads to the instance, so after 30000 milliseconds (see your parameter), then the instance is released.
It uses the HTTP connection threads. So you can't use it for long-standing process.
I would put the long-threading processing in a separated thread.
Or, even better, create one thread per process, and let the system deal with it.
If you process is more than a few seconds, then a dedicated thread makes sense. Your code would be also cleaner.
Offline
Pages: 1