@@ -43,6 +43,9 @@ class OidcManager {
4343 * @param [options.saltRounds] {number} Number of bcrypt password salt rounds
4444 *
4545 * @param [options.debug] {Function} Debug function (defaults to console.log)
46+ *
47+ * @param [config.delayBeforeRegisteringInitialClient] {number} Number of
48+ * milliseconds to delay before initializing a local RP client.
4649 */
4750 constructor ( options ) {
4851 this . storePaths = options . storePaths
@@ -87,6 +90,9 @@ class OidcManager {
8790 * Config for UserStore:
8891 * @param [config.saltRounds] {number} Number of bcrypt password salt rounds
8992 *
93+ * @param [config.delayBeforeRegisteringInitialClient] {number} Number of
94+ * milliseconds to delay before initializing a local RP client.
95+ *
9096 * @return {OidcManager }
9197 */
9298 static from ( config ) {
@@ -97,6 +103,7 @@ class OidcManager {
97103 authCallbackUri : config . authCallbackUri ,
98104 postLogoutUri : config . postLogoutUri ,
99105 saltRounds : config . saltRounds ,
106+ delayBeforeRegisteringInitialClient : config . delayBeforeRegisteringInitialClient ,
100107 storePaths : OidcManager . storePathsFrom ( config . dbPath )
101108 }
102109 let oidc = new OidcManager ( options )
@@ -155,12 +162,18 @@ class OidcManager {
155162 . then ( ( ) => {
156163 this . saveProviderConfig ( )
157164
158- // Use-case: if solid server is deployed behind a load-balancer (e.g. F5, Nginx) there may be a delay between
159- // when the server starting up and the load balancer detected that it's up, which would cause failures when the
160- // solid server is trying to register an **it's own local** initial RP client (i.e. the it won't see itself and
165+ // Use-case: if solid server is deployed behind a load-balancer
166+ // (e.g. F5, Nginx) there may be a delay between
167+ // when the server starting up and the load balancer detected that it's
168+ // up, which would cause failures when the
169+ // solid server is trying to register an **its own local** initial
170+ // RP client (i.e. the it won't see itself and
161171 // we'll get an ECONNRESET error!).
162172 if ( this . delayBeforeRegisteringInitialClient ) {
173+ this . debug ( `Sleeping for ${ this . delayBeforeRegisteringInitialClient } milliseconds` )
163174 sleep ( this . delayBeforeRegisteringInitialClient )
175+ } else {
176+ this . debug ( 'Not sleeping before client registration...' )
164177 }
165178
166179 return this . initLocalRpClient ( )
0 commit comments