Skip to content

Unsubscribe from ble characteristic instantly after cancel call.#81

Open
Nikolas-LFDesigns wants to merge 3 commits intoMonnoroch:masterfrom
Nikolas-LFDesigns:instaunsubscribe
Open

Unsubscribe from ble characteristic instantly after cancel call.#81
Nikolas-LFDesigns wants to merge 3 commits intoMonnoroch:masterfrom
Nikolas-LFDesigns:instaunsubscribe

Conversation

@Nikolas-LFDesigns
Copy link
Collaborator

Related to #14.

@Nikolas-LFDesigns
Copy link
Collaborator Author

А, ну конечно.. пока без тестов

() -> {
subscriptionToCancel.clearCanceled();
if (!subscriptionToCancel.hasAnySubscriber()
&& subscriptionToCancel.status == SubscriptionStatus.SUBSCRIBED) {
Copy link
Owner

Choose a reason for hiding this comment

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

А что будет, если SUBSCRIBING?

Copy link
Owner

Choose a reason for hiding this comment

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

Да и UNSIBSCRIBING тоже.

Copy link
Collaborator Author

@Nikolas-LFDesigns Nikolas-LFDesigns Jan 28, 2020

Choose a reason for hiding this comment

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

Посмотри тест testSubscribeIgnoreCanceledCall, похоже он проходит, а значит всё норм будет.
С unsubscribing еще проще: не даст выполниться, пока не пройдет call отписки.

Copy link
Owner

Choose a reason for hiding this comment

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

Я так и не понял, что будет с SUBSCRIBING. Можешь разобраться? Тесты -- это хорошо, но они тестируют только то, что мы предусмотрели и запрограммировали в тестах.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ну смотри, в случае Rx ситуация чисто гипотетическая, ибо мы не сможем отписаться пока не подпишемся, а так произойдет подписка несмотря на cancel, с чем мы тоже ничего не сделаем, ибо процесс writeDescriptor уже запущен и ты его не отменишь в процессе.

Copy link
Owner

Choose a reason for hiding this comment

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

А вот и не гипотетическая. Мы можем подписать несколько обзерверов и отписывать их пока подписываем новые. И статус соединения тут будет мигать.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Вот последний и определит исход, ну

так уж если мы хотим отписываться сразу же, это просто норма, не понимаю, зачем с этим что-то делать.

Copy link
Owner

Choose a reason for hiding this comment

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

Ох, ну опять ты со своим "да все будет ок, расслабься". Это сложный код, который будет нам гейзенбаги выдавать если мы в обработке ошибок напортачим, тут нельзя отмахиваться. Я позже подумаю сам и верифицирую.

@Nikolas-LFDesigns Nikolas-LFDesigns force-pushed the instaunsubscribe branch 2 times, most recently from 4cd12da to 71f1ff9 Compare January 29, 2020 15:30
@Nikolas-LFDesigns
Copy link
Collaborator Author

Ребейзнул на все фиксы, теперь-то всё? ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants