Skip to content

Commit 5d860c9

Browse files
committed
Fix race: let RYW-aware IAM fetches bypass the rate limiter
When resolveConditionsWithID resolves a stale IamFetchReadyCondition("") with null before the onModelUpdated coroutine registers its condition, the null-rywData fetch wins the rate limiter and blocks the subsequent RYW-consistent fetch for 30s. Skip the rate-limit check when rywData is non-null so the RYW fetch always proceeds. Made-with: Cursor
1 parent 86b6c36 commit 5d860c9

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ internal class InAppMessagesManager(
296296
}
297297
}
298298

299-
// called when a new push subscription is added, or the app id is updated, or a new session starts
300299
private suspend fun fetchMessages(rywData: RywData?) {
301300
// We only want to fetch IAMs if we know the app is in the
302301
// foreground, as we don't want to do this for background
@@ -321,7 +320,7 @@ internal class InAppMessagesManager(
321320

322321
fetchIAMMutex.withLock {
323322
val now = _time.currentTimeMillis
324-
if (lastTimeFetchedIAMs != null && (now - lastTimeFetchedIAMs!!) < _configModelStore.model.fetchIAMMinInterval) {
323+
if (rywData == null && lastTimeFetchedIAMs != null && (now - lastTimeFetchedIAMs!!) < _configModelStore.model.fetchIAMMinInterval) {
325324
return
326325
}
327326

0 commit comments

Comments
 (0)