File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,20 @@ the caller.
55
55
1 . For anything bigger it runs parallel map, but does it asynchronously and sends a response when it
56
56
it done with the work.
57
57
58
+ The idea behind this is simple: If the result is going to be calculatable quicly, then I'll wait for it.
59
+ Otherwise notifiy me when the result is ready.
60
+
61
+ For example, you have a website that does some calculation for the user. If the calculation result is
62
+ obtainable quickly, then just do it and return it to the user. If it looks like it is going to take a while,
63
+ then tell the user "please check back in a few seconds" - or better yet, send them a message via websockets
64
+ when the result is ready.
65
+
66
+ This same technique works for things like processing queues. If nothing is ahead of your task in a queue,
67
+ then you can run it immediately. If the queue is long, then tell the user to check back later. This is actually
68
+ how the Logger works. You don't want your code to slow down, just because the disk is temporarily slow, but most
69
+ of the time you would like to know that the logger completed your task.
70
+
71
+
58
72
Waiting for the delayed result is accomplished by waiting for a message from
59
73
the <b >pid</b >.
60
74
You can’t perform that action at this time.
0 commit comments