Skip to content

Updating getSlotCounts to use sessions allowed - #3183

Merged
lukeis merged 3 commits into
SeleniumHQ:masterfrom
mitchloudenbeck:gridSlotCountUpdate
Nov 29, 2016
Merged

Updating getSlotCounts to use sessions allowed#3183
lukeis merged 3 commits into
SeleniumHQ:masterfrom
mitchloudenbeck:gridSlotCountUpdate

Conversation

@mitchloudenbeck

Copy link
Copy Markdown
Contributor

Switching getSlotCounts to use the maxSessions when counting the total
slots. Old method would count all browser options so the free/total counts
could be much higher than what was actually available.

Mitch Loudenbeck added 2 commits November 29, 2016 09:37
Switching getSlotCounts to use the concurrent sessions when counting the total
slots. Old method would count all browser options so the free/total counts
could be much higher than was actually available.

totalSlots += 1;
}
totalSlots += proxy.getTestSlots().size() > proxy.getMaxNumberOfConcurrentTestSessions() ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

totalSlots += Math.min(proxy.getMaxNumberOfConcurrentTestSessions(), proxy.getTestSlots().size());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

reducing this further... could just get rid of the two other variables and just have:

freeSlots += Math.min(proxy.getMaxNumberOfConcurrentTestSessions(), proxy.getTestSlots().size()) - proxy.getTotalUsed();

and yeah, i agree still need the += :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think having the totalSlots is still valuable info. My goal was getting some better utilization numbers for our grid.
How about removing the freeSlots variable and just doing
result.addProperty("free", totalSlots - usedSlots);

@mach6

mach6 commented Nov 29, 2016

Copy link
Copy Markdown
Member

LGTM, once comments addressed. :)


totalSlots += 1;
}
totalSlots += proxy.getTestSlots().size() > proxy.getMaxNumberOfConcurrentTestSessions() ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Don't we still want += here? It is summing all the slots/sessions of all the nodes connected to the hub.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes, sorry.. I mis-read the code and missed the for loop

@lukeis
lukeis merged commit c65a338 into SeleniumHQ:master Nov 29, 2016
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.

3 participants