Skip to content

Support prioritization of DockerClientProviderStrategies#362

Merged
rnorth merged 8 commits intomasterfrom
strategy_priorities
Jun 21, 2017
Merged

Support prioritization of DockerClientProviderStrategies#362
rnorth merged 8 commits intomasterfrom
strategy_priorities

Conversation

@bsideup
Copy link
Copy Markdown
Member

@bsideup bsideup commented Jun 10, 2017

To improve the start-up time, we can adjust the priorities of strategies based on the environment.

Please review "isApplicable" very carefully to avoid some breaking changes :)

@bsideup bsideup requested review from kiview and rnorth June 10, 2017 16:25
@bsideup bsideup added this to the 1.3.1 milestone Jun 10, 2017
return true;
}

protected int getPriority() {
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.

Maybe worth mentioning in a comment how the priority is used (i.e. highest to lowest) for avoidance of doubt.

throw new IllegalStateException("Could not find a valid Docker environment. Please see logs and check configuration");
return strategies.stream()
.filter(DockerClientProviderStrategy::isApplicable)
.sorted(Comparator.comparing(DockerClientProviderStrategy::getPriority).reversed())
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.

My only slight concern with determining the order at run time is that it means there's no one place you can look in the code to see the sequence. Now people will have to look at the implementations of all the strategies to figure out what order they'll run in.

Having said that, this does allow us to do dynamic prioritisation. So, e.g. as I mentioned on Slack, caching last known good config somewhere. Is that the kind of thing you had in mind too?

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.

Ignore that - the PR title gives it away 🤦‍♂️

👍 !

bsideup added 3 commits June 18, 2017 12:26
# Conflicts:
#	CHANGELOG.md
#	core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java
@rnorth rnorth merged commit 81952c4 into master Jun 21, 2017
@rnorth rnorth deleted the strategy_priorities branch June 21, 2017 20:32
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