Skip to content

Group poller tweaks - #995

Merged
SessionHero01 merged 2 commits into
release/1.21.0from
group-poller-tweaks
Mar 3, 2025
Merged

Group poller tweaks#995
SessionHero01 merged 2 commits into
release/1.21.0from
group-poller-tweaks

Conversation

@SessionHero01

@SessionHero01 SessionHero01 commented Mar 3, 2025

Copy link
Copy Markdown
Collaborator

Basically this:

  1. Take a node from a pool of swarm nodes randomly on each poll
  2. Re-fill the pool with all the swarm nodes upon emptied-out
  3. Removes a snode with server error from the swarm nodes so it will never get reached in this cycle

}

// Take a random snode from the pool
val snode = pollState.pollPool.random().also {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you need this val snode if the content is already set on currentSnode ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's just nice that I don't have to do currentSnode!! everywhere

Log.e(TAG, "Group polling failed due to a server error", badResponse)
}

pollState.swarmNodes -= currentSnode!!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So you're removing the currentSnode no matter what on error? You are not using badResponse at all?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good spotting lol

@SessionHero01
SessionHero01 merged commit b7ab2c5 into release/1.21.0 Mar 3, 2025
@SessionHero01
SessionHero01 deleted the group-poller-tweaks branch March 3, 2025 03:13
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