diff --git a/pom.xml b/pom.xml
index 4c327f5..3b05762 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,7 +55,7 @@
org.assertj
assertj-core
- 3.6.2
+ 3.9.0
test
diff --git a/src/main/java/okra/OkraSyncImpl.java b/src/main/java/okra/OkraSyncImpl.java
index f086fed..b79738e 100644
--- a/src/main/java/okra/OkraSyncImpl.java
+++ b/src/main/java/okra/OkraSyncImpl.java
@@ -29,7 +29,6 @@
import okra.base.sync.AbstractOkraSync;
import okra.exception.InvalidOkraItemException;
import okra.exception.OkraItemNotFoundException;
-import okra.exception.OkraRuntimeException;
import okra.index.IndexCreator;
import okra.serialization.DocumentSerializer;
import okra.util.DateUtil;
@@ -37,6 +36,8 @@
import org.bson.Document;
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.time.LocalDateTime;
import java.util.Date;
@@ -50,6 +51,7 @@ public class OkraSyncImpl extends AbstractOkraSync {
private final Class scheduleItemClass;
private final long defaultHeartbeatExpirationMillis;
private final DocumentSerializer serializer;
+ private static final Logger LOGGER = LoggerFactory.getLogger(OkraSyncImpl.class);
public OkraSyncImpl(final MongoClient client, final String database,
final String collection, final Class scheduleItemClass,
@@ -78,8 +80,7 @@ public Optional poll() {
@Override
public Optional peek() {
- final Bson peekQuery = QueryUtil.generatePeekQuery(defaultHeartbeatExpirationMillis);
-
+ final Bson peekQuery = QueryUtil.generatePeekQuery(defaultHeartbeatExpirationMillis / 1000);
final Document update = new Document();
update.put("heartbeat", new Date());
update.put("status", OkraStatus.PROCESSING.name());
diff --git a/src/main/java/okra/util/QueryUtil.java b/src/main/java/okra/util/QueryUtil.java
index 43248bc..a047025 100644
--- a/src/main/java/okra/util/QueryUtil.java
+++ b/src/main/java/okra/util/QueryUtil.java
@@ -44,7 +44,7 @@ public static Document generateRunDateQueryPart() {
public static Document generateStatusProcessingAndHeartbeatExpiredQuery(final long secondsToGetExpired) {
final Document query = new Document();
query.put("status", OkraStatus.PROCESSING.name());
- query.put("heartbeat", DateUtil.nowMinusSeconds(secondsToGetExpired));
+ query.put("heartbeat", new BasicDBObject("$lt", DateUtil.nowMinusSeconds(secondsToGetExpired)));
return query;
}
diff --git a/src/test/resources/testcontainers.properties b/src/test/resources/testcontainers.properties
new file mode 100644
index 0000000..71f1d22
--- /dev/null
+++ b/src/test/resources/testcontainers.properties
@@ -0,0 +1 @@
+checks.disable=true
\ No newline at end of file