Skip to content

Commit

Permalink
fix: catch filenotfound exception when rollover before upload (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyang1520 authored Feb 3, 2023
1 parent 5547dac commit 80bc1f5
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.FileNotFoundException
import java.lang.Exception
import java.util.concurrent.atomic.AtomicInteger

class EventPipeline(
Expand Down Expand Up @@ -99,7 +98,13 @@ class EventPipeline(
uploadChannel.consumeEach {

withContext(amplitude.storageIODispatcher) {
storage.rollover()
try {
storage.rollover()
} catch (e: FileNotFoundException) {
e.message?.let {
amplitude.logger.warn("Event storage file not found: $it")
}
}
}

val eventsData = storage.readEventsContent()
Expand Down

0 comments on commit 80bc1f5

Please sign in to comment.