Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Correctly emit changed values #656

Merged

Conversation

schroda
Copy link
Collaborator

@schroda schroda commented Aug 12, 2023

"SharedFlow::emit" blocked the flow due not being called in a new coroutine.

@@ -108,7 +109,8 @@ class ServerConfig(getConfig: () -> Config, val moduleName: String = SERVER_CONF
}

val sharedFlow = MutableSharedFlow<T>(extraBufferCapacity = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
actualFlow.distinctUntilChanged().onEach { sharedFlow.emit(it) }.launchIn(mutableConfigValueScope)
actualFlow.distinctUntilChanged().onEach { mutableConfigValueScope.launch { sharedFlow.emit(it) } }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing it to mapLatest would be a better solution

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"SharedFlow::emit" blocked the flow due not being called in a new coroutine.
@schroda schroda force-pushed the fix/listening_to_server_setting_changes branch from 9486cea to 6390f88 Compare August 12, 2023 17:56
@Syer10 Syer10 merged commit d9019b8 into Suwayomi:master Aug 12, 2023
@schroda schroda deleted the fix/listening_to_server_setting_changes branch August 12, 2023 18:11
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants