gen_server partial replies

Bengt Kleberg Bengt.Kleberg@REDACTED
Fri Nov 21 17:29:56 CET 2003


Vlad Dumitrescu wrote:
> I got an idea: would it be possible to add partial replies from a gen_server?
> Would it be useful, or just too specialized?
> 
> What I mean by partial replies is something like this:
> 
>     call find_all_primes_less_than(1000000)
> 
>         {partial_reply, [1, 3, 5, 7]}
>         {partial_reply, [1, 3, 5, 7, 9, ..., 131]}
>         {partial_reply, [1, ..., 1003]}
>         ...
>         {reply, [1, ..., 999997]}
> 
> The effect would be that the partial reply would be added to previous ones,
> until a full reply is received (containing the whole answer). This way lenghty
> operations could be monitored, and there is backwards compatibility (older
> clients just ignore partial replies).
> 

why do you want to do a partial reply? if it is to free up the server 
for other call's, then you could
1 spawn a new process
2 return {noreply, State};
3 use gen_server:reply(Pid, Reply), from the spawned process, when ready 
to do so


bengt




More information about the erlang-questions mailing list