Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Optimize how peer stats are processed #20138

Merged
merged 1 commit into from
May 27, 2024

Conversation

ilmotta
Copy link
Contributor

@ilmotta ilmotta commented May 21, 2024

Motivation from #20059 (Slow app login)

Summary

During login, the signal wakuv2.peerstats happens anywhere between 10-20 times in a very short amount of time. To make things worse, the JS object payload is large(ish) and we are calling clj->js each time.

This simple PR solves this inefficiency by debouncing the event :wakuv2-peer-stats for the duration of 1s. As far as I measured, the event is now only being processed once throughout the entire login flow and the 1s delay to update the app-db should be negligible.

  • Also reordered high-frequency signals to be at the top of the case macro. This is wrong. case has constant-time dispatch and the order of clauses don't matter.
  • Used oops/oget instead of interop because that's our current solution to reliably survive ClojureScript advanced compilation.
  • Reformatted the signals within case macro to minimize git diffs and to be more readable, i.e. expressions are not right-aligned according to longest signal string (less diff in future pRs) and there are less weird line breaks because of this choice.
  • Replaced all calls to (js->clj event-js :keywordize-keys true) to (transforms/js->clj event-js)

Note

This PR won't solve the slow login by issue #20059 (that's mainly a status-go issue I'm investigating separately) but it will help free up re-frame's queue while logging in.

And btw, the login flow in status-im.contexts.profile.login.events is constricting re-frame's queue way too much. I see low-hanging fruits for us there, for instance, delaying dispatching groups of events in different time slots.

Areas that may be impacted

Refactors brought by this PR should be safe and don't require manual QA.

Steps to test

E2E tests should be sufficient, plus my own manual checks.

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented May 21, 2024

Jenkins Builds

Click to see older builds (8)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e099d3e #1 2024-05-21 17:52:38 ~5 min tests 📄log
✔️ e099d3e #1 2024-05-21 17:54:34 ~7 min android-e2e 🤖apk 📲
✔️ e099d3e #1 2024-05-21 17:54:51 ~7 min android 🤖apk 📲
✔️ e099d3e #1 2024-05-21 17:56:16 ~8 min ios 📱ipa 📲
✔️ fa06813 #2 2024-05-21 18:02:58 ~4 min tests 📄log
✔️ fa06813 #2 2024-05-21 18:07:36 ~9 min ios 📱ipa 📲
✔️ fa06813 #2 2024-05-21 18:11:44 ~13 min android 🤖apk 📲
✔️ fa06813 #2 2024-05-21 18:11:47 ~13 min android-e2e 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 282855e #3 2024-05-24 18:41:18 ~4 min tests 📄log
✔️ 282855e #3 2024-05-24 18:44:17 ~7 min android-e2e 🤖apk 📲
✔️ 282855e #3 2024-05-24 18:44:23 ~7 min android 🤖apk 📲
✔️ 282855e #3 2024-05-24 18:54:12 ~17 min ios 📱ipa 📲
✔️ 3d89063 #4 2024-05-27 11:22:22 ~5 min tests 📄log
✔️ 3d89063 #4 2024-05-27 11:24:04 ~7 min android-e2e 🤖apk 📲
✔️ 3d89063 #4 2024-05-27 11:24:44 ~8 min android 🤖apk 📲
✔️ 3d89063 #4 2024-05-27 11:28:23 ~11 min ios 📱ipa 📲

(js->clj event-js :keywordize-keys true)])
"waku.backedup.settings" (rf/dispatch [:profile/update-setting-from-backup
(js->clj event-js :keywordize-keys true)])
"wallet"
Copy link
Member

Choose a reason for hiding this comment

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

do we want to have some comment here about order being of some importance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It won't hurt to add a comment 👍🏼 Let me add it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @J-Son89, an important oversight on my part. case has constant-time dispatch, so the order of clauses doesn't matter. So the order of clauses is essentially based on readability.

^js event-js (.-event data)
type (.-type data)]
(log/debug "Signal received" event-str)
^js event-js (oops/oget data :event)
Copy link
Member

Choose a reason for hiding this comment

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

why do we use oops here?

Copy link
Member

Choose a reason for hiding this comment

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

is this safe to use here? it throws an error if it's nil :/

Copy link
Contributor Author

@ilmotta ilmotta May 21, 2024

Choose a reason for hiding this comment

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

@J-Son89, that's a good question.

oops should pretty much always be used due to advanced compilation. The checks it performs, according to its documentation only happen during development. In advanced compilation, all checks should disappear.

https://github.com/binaryage/cljs-oops?tab=readme-ov-file#play-it-safe-during-development

Copy link
Member

Choose a reason for hiding this comment

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

Can't remember from my experience if this holds true. I'm sure we'll find out soon if not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't remember from my experience if this holds true. I'm sure we'll find out soon if not

I'm not sure either. I'll do a check today to settle this question and will report here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@J-Son89, I just confirmed in a prod build that oops/oget does not throw any exception on missing keys, as is documented in the library.

To give a real example, this is a warning produced now when we do advanced compilation (release build):

------ WARNING #165 - :infer-warning -------------------------------------------
 File: /build/status-mobile-source-jsbundle/src/status_im/contexts/wallet/wallet_connect/effects.cljs:46:10
--------------------------------------------------------------------------------
  43 |    (let [{:keys [params id]} proposal
  44 |          approved-namespaces (wallet-connect/build-approved-namespaces params
  45 |                                                                        supported-namespaces)]
  46 |      (-> (.approveSession web3-wallet
----------------^---------------------------------------------------------------
 Cannot infer target type in expression (. web3-wallet approveSession (clj->js {:id id, :namespaces approved-namespaces}))

This error disappears with the correct type hint or when we use oops/oget.

But that's not the main problem. Advanced compilation renames properties, unless the code access object properties as strings, but we don't do that when we write (.x someObject). oops solves this important problem too.

For the sake of visibility to more folks to help spread the word, cc'ing @clauxx and @smohamedjavid

@ilmotta ilmotta force-pushed the ilmotta/optimize-how-peer-stats-are-processed branch from e099d3e to fa06813 Compare May 21, 2024 17:58
@flexsurfer
Copy link
Member

thank you @ilmotta , i think it would be even better to do it on the go side, so it won't clog the bridge as well

@ilmotta
Copy link
Contributor Author

ilmotta commented May 22, 2024

thank you @ilmotta , i think it would be even better to do it on the go side, so it won't clog the bridge as well

Good suggestion, this could be explored in the future. The frequency at which peer stats is initially emitted is controlled by the waku client itself. We have the chance to debounce in status-go after that, but it raises the question of the time period and if the time we choose is a good one for the desktop client as well.

In fact, for the mobile client, I think we could debounce for much longer because I've seen this signal arrive multiple times after login. I'd consider even 5s or 10s. But I think the desktop client can handle a lot more without choking, so keeping this decision about how long we want to debounce on our side seems better, at this least from this perspective.

This PR brings a tangible improvement. Do you think this solution is good enough to be merged for now?

@ilmotta ilmotta force-pushed the ilmotta/optimize-how-peer-stats-are-processed branch from fa06813 to 282855e Compare May 24, 2024 18:36
@ilmotta ilmotta moved this from REVIEW to E2E Tests in Pipeline for QA May 24, 2024
@ilmotta
Copy link
Contributor Author

ilmotta commented May 24, 2024

Hey reviewers, we need at least one more approval to merge this PR. The changes should be safe & simple, but please let me know if you think anything important should change. Thanks!

@cammellos
Copy link
Member

@ilmotta it's fine to merge this, but just to be aware, we had a chat with @vitvly and we noticed that peer stats are not used at all on mobile.
there's a :disconnected sub but it's not used.
So we agreed to allow to disable it on status-go and remove the mobile code.
Feel free to merge this of course, but just an heads up that we'll likely remove the code soon

@ilmotta
Copy link
Contributor Author

ilmotta commented May 24, 2024

@ilmotta it's fine to merge this, but just to be aware, we had a chat with @vitvly and we noticed that peer stats are not used at all on mobile. there's a :disconnected sub but it's not used. So we agreed to allow to disable it on status-go and remove the mobile code. Feel free to merge this of course, but just an heads up that we'll likely remove the code soon

@cammellos, on the topic of the signal being used or not, the (root) subscription :peer-stats :peers-count is used to show peer count in the advanced settings. Of course it's not a critical feature by any means, but I use it sometimes if that counts 😅

How would you check peer count in the mobile app if we stop consuming the signal?

@cammellos
Copy link
Member

@ilmotta oh I must have missed that, I think best thing is to just query if the user lands on this page in that case

@status-im-auto
Copy link
Member

62% of end-end tests have passed

Total executed tests: 52
Failed tests: 17
Expected to fail tests: 3
Passed tests: 32
IDs of failed tests: 727230,703086,702838,702859,702843,727232,703194,702844,702839,702733,702894,702808,702841,704615,727229,702947,702840 
IDs of expected to fail tests: 702807,703495,703503 

Failed tests (17)

Click to expand
  • Rerun failed tests

  • Class TestWalletOneDevice:

    1. test_wallet_add_remove_watch_only_account, id: 727232

    Device 1: `Text` is `0x8d2413447ff297d30bdc475f6d5cb00254685aae`
    Device 1: Click system back button

    critical/test_wallet.py:213: in test_wallet_add_remove_watch_only_account
        self.home_view.driver.fail(
    base_test_case.py:178: in fail
        pytest.fail('Device %s: %s' % (self.number, text))
     Device 1: Incorrect address '0x8d2413447ff297d30bdc475f6d5cb00254685aae' is shown when swiping between accounts, expected one is '0x8d2413447ff297d30bdc475f6d5cb00254685aae'
    



    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_mark_all_messages_as_read, id: 703086

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    2. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Find LogInButton by accessibility id: login-button
    Device 2: Tap on found: LogInButton

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    3. test_community_one_image_send_reply, id: 702859

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    4. test_community_message_edit, id: 702843

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    5. test_community_several_images_send_reply, id: 703194

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    6. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    7. test_community_message_delete, id: 702839

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    8. test_community_contact_block_unblock_offline, id: 702894

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    9. test_community_unread_messages_badge, id: 702841

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    10. test_community_edit_delete_message_when_offline, id: 704615

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    11. test_community_emoji_send_copy_paste_reply, id: 702840

    Test setup failed: critical/chats/test_public_chat_browsing.py:323: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:425: in join_community
        self.community_status_joined.wait_for_visibility_of_element(60)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Text by accessibility id:`status-tag-positive` is not found on the screen after wait_for_visibility_of_element
    



    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230

    critical/test_wallet.py:119: in test_wallet_send_asset_from_drawer
        self.wallet_view.navigate_back_to_wallet_view()
     'TestWalletMultipleDevice' object has no attribute 'wallet_view'
    



    2. test_wallet_send_eth, id: 727229

    Device 1: Swiping right on element SlideButton
    Device 1: Find SlideButton by xpath: //*[@resource-id='slide-button-track']

    critical/test_wallet.py:111: in test_wallet_send_eth
        self.wallet_1.send_asset(address=self.receiver['address'], asset_name='Ether', amount=amount_to_send)
    ../views/wallet_view.py:100: in send_asset
        self.confirm_transaction()
    ../views/wallet_view.py:87: in confirm_transaction
        self.slide_and_confirm_with_password()
    ../views/wallet_view.py:81: in slide_and_confirm_with_password
        self.slide_button_track.slide()
    ../views/base_view.py:257: in slide
        self.swipe_right_on_element(width_percentage=1.3, start_x=100)
    ../views/base_element.py:308: in swipe_right_on_element
        location, size = self.get_element_coordinates()
    ../views/base_element.py:294: in get_element_coordinates
        element = self.find_element()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: SlideButton by xpath: `//*[@resource-id='slide-button-track']` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_offline_pn, id: 702808

    Device 3: Looking for a message by text: message from old member
    Device 3: Looking for a message by text: message from new member

    critical/chats/test_group_chat.py:326: in test_group_chat_offline_pn
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     message from new member if not shown for device 1
    



    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947

    Device 2: Tap on found: SendMessageButton
    # STEP: Checking unread indicators

    activity_center/test_activity_center.py:319: in test_activity_center_reply_read_unread_delete_filter_swipe
        self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: BaseElement by accessibility id:`activity-center-unread-count` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_text_message_delete_push_disappear, id: 702733

    Device 2: Tap on found: Button
    Device 1: Getting PN by 'DELETE ME'

    critical/chats/test_1_1_public_chats.py:520: in test_1_1_chat_text_message_delete_push_disappear
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Message status was not changed to 'Delivered' after 60 s
    



    Device sessions

    Expected to fail tests (3)

    Click to expand

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_join_send_text_messages_push, id: 702807

    Device 2: Find Text by xpath: //*[starts-with(@text,'Hey, admin!')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[@content-desc='message-status']/android.widget.TextView
    Device 2: Text is Sent

    critical/chats/test_group_chat.py:97: in test_group_chat_join_send_text_messages_push
        self.chats[1].chat_element_by_text(message_to_admin).wait_for_status_to_be('Delivered', timeout=120)
    ../views/chat_view.py:225: in wait_for_status_to_be
        raise TimeoutException("Message status was not changed to %s, it's %s" % (expected_status, current_status))
     Message status was not changed to Delivered, it's Sent 
    

    [[Issue with a message status - Sent instead of Delivered, https://github.com//issues/20126]]

    Device sessions

    2. test_group_chat_mute_chat, id: 703495

    # STEP: Change device time so chat will be unmuted by timer
    Device 2: Long press on ChatElement

    critical/chats/test_group_chat.py:466: in test_group_chat_mute_chat
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Chat is still muted after timeout 
    

    [[Chat is not unmuted after expected time: https://github.com//issues/19627]]

    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_discovery, id: 703503

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Curated communities not loading, https://github.com//issues/17852]]

    Passed tests (32)

    Click to expand

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_mentions_push_notification, id: 702786
    Device sessions

    2. test_community_join_when_node_owner_offline, id: 703629
    Device sessions

    3. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    4. test_community_markdown_support, id: 702809
    Device sessions

    5. test_community_leave, id: 702845
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    2. test_add_contact_field_validation, id: 702777
    Device sessions

    3. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_reactions, id: 703202
    Device sessions

    3. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_deep_links, id: 702775
    Device sessions

    2. test_links_open_universal_links_from_chat, id: 704613
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    3. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    4. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    5. test_1_1_chat_edit_message, id: 702855
    Device sessions

    6. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    7. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    2. test_activity_center_mentions, id: 702957
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_mute_community_and_channel, id: 703382
    Device sessions

    3. test_community_undo_delete_message, id: 702869
    Device sessions

    4. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    5. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    @ilmotta
    Copy link
    Contributor Author

    ilmotta commented May 24, 2024

    @status-im/mobile-qa, can you help me understand if the e2e failures are expected? As far as my testing goes and from the videos themselves, I can tell signals are being processed just like in develop. The changes in this PR are almost just cosmetical.

    @ilmotta
    Copy link
    Contributor Author

    ilmotta commented May 24, 2024

    @cammellos, @vitvly I found another place deserving our attention. The profile visibility status event :visibility-status-updates/visibility-status-option-pressed relies on the current peer count. Whenever the user changes the visibility status type (automatic/etc) the peer count is used, so we can't remove the signal without catering for this use case. I'll implement in issue #20176 a similar solution you suggested @cammellos, I'll synchronously get the peer count, just this time in the event layer.

    PR will come next week, it's almost done https://github.com/status-im/status-mobile/compare/ilmotta/optimize-how-peer-stats-are-processed...ilmotta/do-not-process-signal-wakuv2-peerstats?expand=1

    @vitvly
    Copy link
    Member

    vitvly commented May 25, 2024

    I’ll modify status-im/status-go#5224 so that there is a flag to disable peerstats signal altogether. Then mobile will query for peer stats when needed.

    @churik churik moved this from E2E Tests to REVIEW in Pipeline for QA May 27, 2024
    @churik churik moved this from REVIEW to E2E Tests in Pipeline for QA May 27, 2024
    @churik
    Copy link
    Member

    churik commented May 27, 2024

    I'm relaunching e2e, as they have been failed mostly due to reliability issues, and checking login in a user with sufficient amount of data (just in case)

    Thank you for the detailed explanation @ilmotta!

    @churik churik self-assigned this May 27, 2024
    @churik
    Copy link
    Member

    churik commented May 27, 2024

    Logout for the same user works about the same (like you mentioned in the PR): about 17s for several communities / several 1-1 chats, waiting for e2e tests

    @status-im-auto
    Copy link
    Member

    88% of end-end tests have passed

    Total executed tests: 52
    Failed tests: 3
    Expected to fail tests: 3
    Passed tests: 46
    
    IDs of failed tests: 727230,727229,727232 
    
    IDs of expected to fail tests: 703495,703503,702807 
    

    Failed tests (3)

    Click to expand
  • Rerun failed tests

  • Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    critical/test_wallet.py:119: in test_wallet_send_asset_from_drawer
        self.wallet_view.navigate_back_to_wallet_view()
     'TestWalletMultipleDevice' object has no attribute 'wallet_view'
    



    2. test_wallet_send_eth, id: 727229

    Device 1: Swiping right on element SlideButton
    Device 1: Find SlideButton by xpath: //*[@resource-id='slide-button-track']

    critical/test_wallet.py:111: in test_wallet_send_eth
        self.wallet_1.send_asset(address=self.receiver['address'], asset_name='Ether', amount=amount_to_send)
    ../views/wallet_view.py:100: in send_asset
        self.confirm_transaction()
    ../views/wallet_view.py:87: in confirm_transaction
        self.slide_and_confirm_with_password()
    ../views/wallet_view.py:81: in slide_and_confirm_with_password
        self.slide_button_track.slide()
    ../views/base_view.py:257: in slide
        self.swipe_right_on_element(width_percentage=1.3, start_x=100)
    ../views/base_element.py:308: in swipe_right_on_element
        location, size = self.get_element_coordinates()
    ../views/base_element.py:294: in get_element_coordinates
        element = self.find_element()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: SlideButton by xpath: `//*[@resource-id='slide-button-track']` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Class TestWalletOneDevice:

    1. test_wallet_add_remove_watch_only_account, id: 727232

    Device 1: Text is 0x8d2413447ff297d30bdc475f6d5cb00254685aae
    Device 1: Click system back button

    critical/test_wallet.py:213: in test_wallet_add_remove_watch_only_account
        self.home_view.driver.fail(
    base_test_case.py:178: in fail
        pytest.fail('Device %s: %s' % (self.number, text))
     Device 1: Incorrect address '0x8d2413447ff297d30bdc475f6d5cb00254685aae' is shown when swiping between accounts, expected one is '0x8d2413447ff297d30bdc475f6d5cb00254685aae'
    



    Device sessions

    Expected to fail tests (3)

    Click to expand

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495

    # STEP: Change device time so chat will be unmuted by timer
    Device 2: Long press on ChatElement

    critical/chats/test_group_chat.py:466: in test_group_chat_mute_chat
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Chat is still muted after timeout 
    

    [[Chat is not unmuted after expected time: https://github.com//issues/19627]]

    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807

    Device 2: Find Text by xpath: //*[starts-with(@text,'Hey, admin!')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[@content-desc='message-status']/android.widget.TextView
    Device 2: Text is Sent

    critical/chats/test_group_chat.py:97: in test_group_chat_join_send_text_messages_push
        self.chats[1].chat_element_by_text(message_to_admin).wait_for_status_to_be('Delivered', timeout=120)
    ../views/chat_view.py:225: in wait_for_status_to_be
        raise TimeoutException("Message status was not changed to %s, it's %s" % (expected_status, current_status))
     Message status was not changed to Delivered, it's Sent 
    

    [[Issue with a message status - Sent instead of Delivered, https://github.com//issues/20126]]

    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_discovery, id: 703503

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Curated communities not loading, https://github.com//issues/17852]]

    Passed tests (46)

    Click to expand

    Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936
    Device sessions

    2. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    4. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    5. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    6. test_community_edit_delete_message_when_offline, id: 704615
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    9. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    10. test_community_message_edit, id: 702843
    Device sessions

    11. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_markdown_support, id: 702809
    Device sessions

    2. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    3. test_community_mentions_push_notification, id: 702786
    Device sessions

    4. test_community_leave, id: 702845
    Device sessions

    5. test_community_join_when_node_owner_offline, id: 703629
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    3. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    4. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    5. test_1_1_chat_edit_message, id: 702855
    Device sessions

    6. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    7. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    8. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_add_contact_field_validation, id: 702777
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    3. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_open_universal_links_from_chat, id: 704613
    Device sessions

    2. test_links_deep_links, id: 702775
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    3. test_group_chat_reactions, id: 703202
    Device sessions

    4. test_group_chat_offline_pn, id: 702808
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    3. test_community_undo_delete_message, id: 702869
    Device sessions

    4. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    5. test_community_mute_community_and_channel, id: 703382
    Device sessions

    @churik churik moved this from E2E Tests to MERGE in Pipeline for QA May 27, 2024
    - Debounce peer stats signals by 1s because they may happen 30 times during
    login and the payload conversion using js->clj is not cheap.
    
    - Change the order of case macro checks: put more frequent signals at the top.
    
    - Better format code
    @jo-mut jo-mut force-pushed the ilmotta/optimize-how-peer-stats-are-processed branch from 282855e to 3d89063 Compare May 27, 2024 11:16
    @jo-mut jo-mut merged commit 00a9555 into develop May 27, 2024
    6 checks passed
    @jo-mut jo-mut deleted the ilmotta/optimize-how-peer-stats-are-processed branch May 27, 2024 11:29
    Pipeline for QA automation moved this from MERGE to DONE May 27, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Status: DONE
    Development

    Successfully merging this pull request may close these issues.

    None yet

    9 participants