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

add an option to configure timeout #6912

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,6 @@
<constructor-arg index="1" value="${org.orcid.core.utils.cache.redis.port}" />
<constructor-arg index="2" value="${org.orcid.core.utils.cache.redis.password}" />
<constructor-arg index="3" value="${org.orcid.core.utils.cache.redis.expiration_in_secs:600}" />
<constructor-arg index="4" value="${org.orcid.core.utils.cache.redis.connection_timeout_millis:10000}" />
</bean>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.orcid.utils.alerting.SlackManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

import redis.clients.jedis.DefaultJedisClientConfig;
import redis.clients.jedis.HostAndPort;
Expand All @@ -24,7 +25,7 @@ public class RedisClient {
private static final Logger LOG = LoggerFactory.getLogger(RedisClient.class);

private static final int DEFAULT_CACHE_EXPIRY = 60;
private static final int DEFAULT_TIMEOUT = 5000;
private static final int DEFAULT_TIMEOUT = 10000;

private final String redisHost;
private final int redisPort;
Expand All @@ -37,7 +38,7 @@ public class RedisClient {
@Resource
private SlackManager slackManager;

// Assume the connection to Redis is disabled by default
// Assume the connection to Redis is disabled by default
private boolean enabled = false;

public RedisClient(String redisHost, int redisPort, String password) {
Expand Down Expand Up @@ -66,10 +67,6 @@ public RedisClient(String redisHost, int redisPort, String password, int cacheEx

@PostConstruct
private void init() {
if(!enabled) {
LOG.debug("Redis is not enabled, so, it will not be initilized");
return;
}
try {
JedisClientConfig config = DefaultJedisClientConfig.builder().connectionTimeoutMillis(this.clientTimeoutInMillis).timeoutMillis(this.clientTimeoutInMillis)
.socketTimeoutMillis(this.clientTimeoutInMillis).password(this.redisPassword).ssl(true).build();
Expand Down
1 change: 1 addition & 0 deletions orcid-core/src/main/resources/orcid-core-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@
<constructor-arg index="1" value="${org.orcid.core.utils.cache.redis.port}" />
<constructor-arg index="2" value="${org.orcid.core.utils.cache.redis.password}" />
<constructor-arg index="3" value="${org.orcid.core.utils.cache.redis.expiration_in_secs:600}" />
<constructor-arg index="4" value="${org.orcid.core.utils.cache.redis.connection_timeout_millis:10000}" />
</bean>

<bean id="emailDomainManager" class="org.orcid.core.common.manager.impl.EmailDomainManagerImpl"/>
Expand Down