Skip to content

Commit 6afc247

Browse files
Fix atomic type
1 parent 8c65585 commit 6afc247

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ import reactor.core.publisher.Mono
2323
import discord4j.core.object.ThreadListPart
2424

2525
import java.time.Instant
26+
import java.util.concurrent.atomic.AtomicInteger
2627
import java.util.concurrent.atomic.AtomicLong
2728
import java.util.function.Function
2829
import java.util.function.LongFunction
30+
import java.util.function.ToIntFunction
2931
import java.util.function.ToLongFunction;
3032
import java.util.zip.ZipEntry
3133
import java.util.zip.ZipOutputStream
@@ -70,18 +72,18 @@ class FixRestChannel {
7072
list.isEmpty() ? startAt : keyExtractor.applyAsInstant(list.get(list.size() - 1)).getEpochSecond()
7173
}
7274

73-
final ToLongFunction<List<T>> updateLast_ns = { list ->
75+
final ToIntFunction<List<T>> updateLast_ns = { list ->
7476
list.isEmpty() ? startAt : keyExtractor.applyAsInstant(list.get(list.size() - 1)).getNano()
7577
}
7678

7779
final Comparator<T> comparator = comparingInstant(keyExtractor);
7880
final AtomicLong previousStart = new AtomicLong(startAt.getEpochSecond());
79-
final AtomicLong previousStart_ns = new AtomicLong(startAt.getNano());
81+
final AtomicInteger previousStart_ns = new AtomicLong(startAt.getNano());
8082

8183
return Flux.defer { nextPage.apply(previousStart.get(), previousStart_ns.get()) }
8284
.sort(reverse ? comparator.reversed() : comparator)
8385
.collectList()
84-
.doOnNext{list -> previousStart.set(updateLast.applyAsLong(list)); previousStart_ns.set(updateLast_ns.applyAsLong(list)) }
86+
.doOnNext{list -> previousStart.set(updateLast.applyAsLong(list)); previousStart_ns.set(updateLast_ns.applyAsInt(list)) }
8587
.flatMapMany(Flux.&fromIterable)
8688
.repeat { previousStart.get() != startAt.getEpochSecond() && previousStart_ns.get() != startAt.getNano() };
8789
}

0 commit comments

Comments
 (0)