@@ -62,11 +62,6 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou
6262 ],
6363 'timeout ' => 10 ,
6464 ]);
65-
66- // this is needed here because the deletion happens in a concurrent request
67- // and thus the cached value in the config object would trigger an UPDATE
68- // instead of an INSERT if there is another request to the API server
69- $ this ->config ->deleteAppValue ('spreed ' , 'hosted-signaling-server-nonce ' );
7065 } catch (ClientException $ e ) {
7166 $ response = $ e ->getResponse ();
7267
@@ -182,6 +177,11 @@ public function registerAccount(RegisterAccountData $registerAccountData): Accou
182177 $ this ->logger ->error ('Failed to request hosted signaling server trial ' , ['exception ' => $ e ]);
183178 $ message = $ this ->l10n ->t ('Failed to request trial because the trial server is unreachable. Please try again later. ' );
184179 throw new HostedSignalingServerAPIException ($ message , ($ e instanceof ServerException ? $ e ->getResponse ()?->getStatusCode() : null ) ?? Http::STATUS_INTERNAL_SERVER_ERROR );
180+ } finally {
181+ // this is needed here because the deletion happens in a concurrent request
182+ // and thus the cached value in the config object would trigger an UPDATE
183+ // instead of an INSERT if there is another request to the API server
184+ $ this ->config ->deleteAppValue ('spreed ' , 'hosted-signaling-server-nonce ' );
185185 }
186186
187187 $ status = $ response ->getStatusCode ();
@@ -234,11 +234,6 @@ public function fetchAccountInfo(AccountId $accountId) {
234234 ],
235235 'timeout ' => 10 ,
236236 ]);
237-
238- // this is needed here because the delete happens in a concurrent request
239- // and thus the cached value in the config object would trigger an UPDATE
240- // instead of an INSERT if there is another request to the API server
241- $ this ->config ->deleteAppValue ('spreed ' , 'hosted-signaling-server-nonce ' );
242237 } catch (ClientException $ e ) {
243238 $ response = $ e ->getResponse ();
244239
@@ -317,6 +312,11 @@ public function fetchAccountInfo(AccountId $accountId) {
317312 $ this ->logger ->error ('Failed to request hosted signaling server trial ' , ['exception ' => $ e ]);
318313 $ message = $ this ->l10n ->t ('Failed to fetch account information because the trial server is unreachable. Please check back later. ' );
319314 throw new HostedSignalingServerAPIException ($ message , ($ e instanceof ServerException ? $ e ->getResponse ()?->getStatusCode() : null ) ?? Http::STATUS_INTERNAL_SERVER_ERROR );
315+ } finally {
316+ // this is needed here because the delete happens in a concurrent request
317+ // and thus the cached value in the config object would trigger an UPDATE
318+ // instead of an INSERT if there is another request to the API server
319+ $ this ->config ->deleteAppValue ('spreed ' , 'hosted-signaling-server-nonce ' );
320320 }
321321
322322 $ status = $ response ->getStatusCode ();
@@ -388,11 +388,6 @@ public function deleteAccount(AccountId $accountId): void {
388388 ],
389389 'timeout ' => 10 ,
390390 ]);
391-
392- // this is needed here because the delete happens in a concurrent request
393- // and thus the cached value in the config object would trigger an UPDATE
394- // instead of an INSERT if there is another request to the API server
395- $ this ->config ->deleteAppValue ('spreed ' , 'hosted-signaling-server-nonce ' );
396391 } catch (ClientException $ e ) {
397392 $ response = $ e ->getResponse ();
398393
@@ -471,6 +466,11 @@ public function deleteAccount(AccountId $accountId): void {
471466 $ this ->logger ->error ('Deleting the hosted signaling server account failed ' , ['exception ' => $ e ]);
472467 $ message = $ this ->l10n ->t ('Failed to delete the account because the trial server is unreachable. Please check back later. ' );
473468 throw new HostedSignalingServerAPIException ($ message , ($ e instanceof ServerException ? $ e ->getResponse ()?->getStatusCode() : null ) ?? Http::STATUS_INTERNAL_SERVER_ERROR );
469+ } finally {
470+ // this is needed here because the delete happens in a concurrent request
471+ // and thus the cached value in the config object would trigger an UPDATE
472+ // instead of an INSERT if there is another request to the API server
473+ $ this ->config ->deleteAppValue ('spreed ' , 'hosted-signaling-server-nonce ' );
474474 }
475475
476476 $ status = $ response ->getStatusCode ();
0 commit comments