Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final Result<Record> fetch = sourceDbContext.select()
- .from(table(properties.getTable()))
- .where(field(UPDATED_AT).eq(currentOffset)
- .and(field(ID).greaterThan(currentOffsetId))
- .and(field(UPDATED_AT).lessThan(offsetNow.minusSeconds(fetchDelayInSeconds))))
- .orderBy(field(UPDATED_AT), field(ID))
- .limit(batchSize)
- .fetch();
- if (fetch.size() < batchSize) {
- final Result<Record> fetchGtUpdatedAt = sourceDbContext.select()
- .from(table(properties.getTable()))
- .where(field(UPDATED_AT).greaterThan(currentOffset)
- .and(field(UPDATED_AT).lessThan(offsetNow.minusSeconds(fetchDelayInSeconds))))
- .orderBy(field(UPDATED_AT), field(ID))
- .limit(batchSize - fetch.size())
- .fetch();
- fetch.addAll(fetchGtUpdatedAt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement