-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[consul] handle blocked query timeout
- Loading branch information
1 parent
d194683
commit 10a26e0
Showing
10 changed files
with
75 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/java/com/frogdevelopment/micronaut/consul/watch/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
@Configuration | ||
@RequiresConsul | ||
@Requires(property = "consul.watch.disabled", notEquals = "true", defaultValue = "false") | ||
@Requires(property = WatcherConfiguration.PREFIX + "disabled", notEquals = "true", defaultValue = "false") | ||
package com.frogdevelopment.micronaut.consul.watch; | ||
|
||
import com.frogdevelopment.micronaut.consul.watch.watcher.WatcherConfiguration; | ||
|
||
import io.micronaut.context.annotation.Configuration; | ||
import io.micronaut.context.annotation.Requires; | ||
import io.micronaut.discovery.consul.condition.RequiresConsul; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/com/frogdevelopment/micronaut/consul/watch/watcher/WatcherConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.frogdevelopment.micronaut.consul.watch.watcher; | ||
|
||
import java.time.Duration; | ||
|
||
import io.micronaut.context.annotation.ConfigurationProperties; | ||
import io.micronaut.core.annotation.Nullable; | ||
import io.micronaut.discovery.consul.condition.RequiresConsul; | ||
|
||
/** | ||
* Configuration for Consul Watcher | ||
* | ||
* @author LE GALL Benoît | ||
* @since 1.0.0 | ||
*/ | ||
@RequiresConsul | ||
@ConfigurationProperties(WatcherConfiguration.PREFIX) | ||
public class WatcherConfiguration { | ||
|
||
/** | ||
* The default block timeout in minutes. | ||
*/ | ||
@SuppressWarnings("WeakerAccess") | ||
public static final long DEFAULT_BLOCK_TIMEOUT_MINUTES = 10; | ||
|
||
/** | ||
* The prefix to use for all Consul settings. | ||
*/ | ||
public static final String PREFIX = "consul.watch"; | ||
|
||
private Duration blockTimeout = Duration.ofMinutes(DEFAULT_BLOCK_TIMEOUT_MINUTES); | ||
|
||
/** | ||
* Sets the block timeout. Default value ({@value #DEFAULT_BLOCK_TIMEOUT_MINUTES} minutes). | ||
* | ||
* @param blockTimeout The block timeout | ||
*/ | ||
public void setBlockTimeout(@Nullable Duration blockTimeout) { | ||
this.blockTimeout = blockTimeout; | ||
} | ||
|
||
/** | ||
* @return The block timeout. | ||
*/ | ||
public Duration getBlockTimeout() { | ||
return blockTimeout; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
consul: | ||
client: | ||
read-idle-timeout: 15s | ||
read-timeout: 30s | ||
read-timeout: 2s | ||
watch: | ||
block-timeout: 5s |