diff --git a/lib/utils/keyserver-call.js b/lib/utils/keyserver-call.js --- a/lib/utils/keyserver-call.js +++ b/lib/utils/keyserver-call.js @@ -97,32 +97,39 @@ args: Args, options?: ?CallServerEndpointOptions, ) => { - // TODO + const bindCallKeyserverEndpoint = (keyserverID: string) => { + const { + cookie, + urlPrefix, + sessionID, + connection, + lastCommunicatedPlatformDetails, + } = keyserverInfos[keyserverID]; + + const boundCallServerEndpoint = boundCallServerEndpointSelector({ + dispatch, + currentUserInfo, + cookie, + urlPrefix, + sessionID, + connectionStatus: connection.status, + lastCommunicatedPlatformDetails, + }); + + return boundCallServerEndpoint(endpoint, data, options); + }; if (keyserverCall.config.keyserverSelection === 'fanout') { - return Promise.resolve(undefined); + const promises = []; + for (const keyserverID in keyserverInfos) { + promises.push(bindCallKeyserverEndpoint(keyserverID)); + } + return Promise.all(promises); } + const keyserverID = keyserverCall.config.keyserverIDExtractor( ...args, ); - const { - cookie, - urlPrefix, - sessionID, - connection, - lastCommunicatedPlatformDetails, - } = keyserverInfos[keyserverID]; - - const boundCallServerEndpoint = boundCallServerEndpointSelector({ - dispatch, - currentUserInfo, - cookie, - urlPrefix, - sessionID, - connectionStatus: connection.status, - lastCommunicatedPlatformDetails, - }); - - return boundCallServerEndpoint(endpoint, data, options); + return bindCallKeyserverEndpoint(keyserverID); }; return keyserverCall.actionFunc(callKeyserverEndpoint);