1
1
node-finagle
2
2
=======================
3
3
4
- Proof of concept lib of a finagle-like composable ` Service ` in node.
4
+ Proof of concept lib of a finagle-like composable ` Service ` / ` Filter ` in node.
5
5
6
6
A ` Service ` is basically a function ` (input) => Promise<output> `
7
7
@@ -15,7 +15,6 @@ Things to support in mind:
15
15
- Batch fork-join
16
16
- Retry
17
17
- Hedging requests ([ more info] ( https://blog.acolyer.org/2015/01/15/the-tail-at-scale/ ) )
18
- - Connection pooling
19
18
20
19
21
20
Ideally it should be built on top of proved libraries like ` dataloader ` , ` bluebird ` and ` generic-pool `
@@ -27,20 +26,18 @@ Idea:
27
26
val filterStack = (
28
27
FilterStack
29
28
.prepare ()
30
- .andThen (batching)
31
- .andThen (circuitBreaker ({ requiredSuccessRate: 0.90 , markDeadSeconds: 5 })),
32
- .andThen (forkJoin .list ({ minBatchSize: 10 })),
33
- .andThen (hedgeRequest ({ percentile: 95 , minMs: 5 })),
34
- .andThen (connectionPooling (pool))
29
+ .andThen (circuitBreaker (/* options */ )),
30
+ .andThen (caching (/* options */ ))
31
+ .andThen (batching (/* options */ ))
32
+ .andThen (dedup (/* options */ ))
33
+ .andThen (forkJoin (/* options */ )),
34
+ .andThen (hedgeRequest (/* options */ )),
35
35
);
36
36
37
- val loader = filterStack .build (({ client, args }) => {
38
- client .doSomething (args);
39
- });
37
+ val loader = filterStack .build ((req ) => client .loadMany (req .ids ));
40
38
41
39
const x = loader (1 );
42
40
const y = loader (2 );
43
-
44
41
```
45
42
46
43
0 commit comments