Skip to content

Commit

Permalink
#113 | Add an offset of 1millisec instead of 1sec
Browse files Browse the repository at this point in the history
  • Loading branch information
himeshr committed Jan 8, 2024
1 parent b655a9c commit 47a2910
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import java.util.Date;

public interface ErrorRecordWorker {
long SECONDS_TO_ADD = 1l;
long MILLI_SECONDS_TO_ADD = 1l;

/**
* Add an offset to avoid syncing the last Avni encounter to Goonj
* @param status
* @return EffectiveCutoffDateTime
*/
default Date getEffectiveCutoffDateTime(IntegratingEntityStatus status) {
return new Date(status.getReadUptoDateTime().toInstant().plusSeconds(ErrorRecordWorker.SECONDS_TO_ADD)
return new Date(status.getReadUptoDateTime().toInstant().plusMillis(ErrorRecordWorker.MILLI_SECONDS_TO_ADD)
.toEpochMilli());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.HashMap;

public abstract class GeneralEncounterWorker implements ErrorRecordWorker {
public static final int SECONDS_TO_ADD = 1;
public static final int MILLI_SECONDS_TO_ADD = 1;
private static final int INT_CONSTANT_ONE = 1;
private final AvniEncounterRepository avniEncounterRepository;
private final AvniSubjectRepository avniSubjectRepository;
Expand Down Expand Up @@ -85,7 +85,7 @@ public void processEncounters() throws Exception {
* @return EffectiveCutoffDateTime
*/
private Date getEffectiveCutoffDateTime(IntegratingEntityStatus status) {
return new Date(status.getReadUptoDateTime().toInstant().plusSeconds(SECONDS_TO_ADD)
return new Date(status.getReadUptoDateTime().toInstant().plusMillis(MILLI_SECONDS_TO_ADD)
.toEpochMilli());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.HashMap;

public abstract class SubjectWorker implements ErrorRecordWorker {
public static final int SECONDS_TO_ADD = 1;
public static final int MILLI_SECONDS_TO_ADD = 1;
private static final int INT_CONSTANT_ONE = 1;
private final AvniSubjectRepository avniSubjectRepository;
private final AvniIgnoredConceptsRepository avniIgnoredConceptsRepository;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void processSubjects() throws Exception {
* @return EffectiveCutoffDateTime
*/
private Date getEffectiveCutoffDateTime(IntegratingEntityStatus status) {
return new Date(status.getReadUptoDateTime().toInstant().plusSeconds(SECONDS_TO_ADD)
return new Date(status.getReadUptoDateTime().toInstant().plusMillis(MILLI_SECONDS_TO_ADD)
.toEpochMilli());
}

Expand Down

0 comments on commit 47a2910

Please sign in to comment.