Make write operations in `AccountDatabaseCrawlerCache` synchronous.
This commit is contained in:
parent
c2e72c7641
commit
38f9b8f3dd
|
@ -62,7 +62,7 @@ public class AccountDatabaseCrawlerCache {
|
||||||
public void clearAccelerate() {
|
public void clearAccelerate() {
|
||||||
try (Jedis jedis = jedisPool.getWriteResource()) {
|
try (Jedis jedis = jedisPool.getWriteResource()) {
|
||||||
jedis.del(ACCELERATE_KEY);
|
jedis.del(ACCELERATE_KEY);
|
||||||
cacheCluster.useWriteCluster(connection -> connection.async().del(ACCELERATE_KEY));
|
cacheCluster.useWriteCluster(connection -> connection.sync().del(ACCELERATE_KEY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class AccountDatabaseCrawlerCache {
|
||||||
|
|
||||||
if (claimed) {
|
if (claimed) {
|
||||||
// TODO Restore the NX flag when making the cluster the primary data store
|
// TODO Restore the NX flag when making the cluster the primary data store
|
||||||
cacheCluster.useWriteCluster(connection -> connection.async().set(ACCELERATE_KEY, workerId, SetArgs.Builder.px(ttlMs)));
|
cacheCluster.useWriteCluster(connection -> connection.sync().set(ACCELERATE_KEY, workerId, SetArgs.Builder.px(ttlMs)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return claimed;
|
return claimed;
|
||||||
|
@ -114,10 +114,10 @@ public class AccountDatabaseCrawlerCache {
|
||||||
try (Jedis jedis = jedisPool.getWriteResource()) {
|
try (Jedis jedis = jedisPool.getWriteResource()) {
|
||||||
if (lastUuid.isPresent()) {
|
if (lastUuid.isPresent()) {
|
||||||
jedis.psetex(LAST_UUID_KEY, LAST_NUMBER_TTL_MS, lastUuid.get().toString());
|
jedis.psetex(LAST_UUID_KEY, LAST_NUMBER_TTL_MS, lastUuid.get().toString());
|
||||||
cacheCluster.useWriteCluster(connection -> connection.async().psetex(LAST_UUID_KEY, LAST_NUMBER_TTL_MS, lastUuid.get().toString()));
|
cacheCluster.useWriteCluster(connection -> connection.sync().psetex(LAST_UUID_KEY, LAST_NUMBER_TTL_MS, lastUuid.get().toString()));
|
||||||
} else {
|
} else {
|
||||||
jedis.del(LAST_UUID_KEY);
|
jedis.del(LAST_UUID_KEY);
|
||||||
cacheCluster.useWriteCluster(connection -> connection.async().del(LAST_UUID_KEY));
|
cacheCluster.useWriteCluster(connection -> connection.sync().del(LAST_UUID_KEY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue