-
-
Save ionoy/736ae9d482d480c05177 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allMessages.GroupBy(msg => msg.Type) | |
.Select(g => g.Throttle(TimeSpan.FromSeconds(0.5)) // Ждём паузы между сообщениями | |
.Select(msg => HandleMessage(msg)) // HandleMessage возвращает Task<Result> | |
.Switch() // Если придёт новое сообщение этого типа, то старый ответ будет игнорирован | |
.SelectMany(res => SendResponse(res))) | |
.Subscribe() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment