Description
The Google Play adapter appears to have a retry mechanism for initialization failures, but the retry does not actually execute bridge.init() again.
GooglePlayAdapter.initialize() caches its promise:
if (this.initializationPromise)
return this.initializationPromise;
When bridge.init() fails, initialization schedules another attempt using:
this.retry.retry(() => this.initialize());
However, when the retry calls initialize() again, this.initializationPromise is already set, so the method immediately returns the existing promise instead of calling bridge.init() again.
As a result, the retry mechanism does not perform another initialization attempt.
Steps to reproduce
- Make the first call to
bridge.init() fail with a retryable initialization error.
- Allow the internal retry mechanism to run.
- Make
bridge.init() succeed if called again.
- Count how many times
bridge.init() is invoked.
Actual behavior
bridge.init() is called only once.
The retry calls initialize() again, but it returns the already cached initializationPromise.
Expected behavior
A retry should perform another actual call to bridge.init().
For example, the retry could invoke the underlying initialization operation directly instead of calling the memoized initialize() method.
Possible direction
Instead of:
this.retry.retry(() => this.initialize());
the adapter could retry the operation that calls:
while keeping the original initialization promise pending until initialization eventually succeeds or reaches a terminal error.
A regression test checking that bridge.init() is called twice after one retryable failure would also make this behavior explicit.
Description
The Google Play adapter appears to have a retry mechanism for initialization failures, but the retry does not actually execute
bridge.init()again.GooglePlayAdapter.initialize()caches its promise:When
bridge.init()fails, initialization schedules another attempt using:However, when the retry calls
initialize()again,this.initializationPromiseis already set, so the method immediately returns the existing promise instead of callingbridge.init()again.As a result, the retry mechanism does not perform another initialization attempt.
Steps to reproduce
bridge.init()fail with a retryable initialization error.bridge.init()succeed if called again.bridge.init()is invoked.Actual behavior
bridge.init()is called only once.The retry calls
initialize()again, but it returns the already cachedinitializationPromise.Expected behavior
A retry should perform another actual call to
bridge.init().For example, the retry could invoke the underlying initialization operation directly instead of calling the memoized
initialize()method.Possible direction
Instead of:
the adapter could retry the operation that calls:
while keeping the original initialization promise pending until initialization eventually succeeds or reaches a terminal error.
A regression test checking that
bridge.init()is called twice after one retryable failure would also make this behavior explicit.