Skip to content

Commit

Permalink
fix timer
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Jun 5, 2024
1 parent 85612ac commit cb39eec
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import com.greenart7c3.citrine.database.toEvent
import com.greenart7c3.citrine.server.CustomWebSocketServer
import com.greenart7c3.citrine.server.EventSubscription
import com.greenart7c3.citrine.utils.isEphemeral
import java.util.Timer
import kotlin.concurrent.schedule
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import java.util.Timer
import java.util.TimerTask

class WebSocketServerService : Service() {
lateinit var webSocketServer: CustomWebSocketServer
Expand Down Expand Up @@ -71,15 +71,17 @@ class WebSocketServerService : Service() {

val database = AppDatabase.getDatabase(this@WebSocketServerService)

eventsToDelete(database)

timer?.cancel()
timer = Timer()
timer?.schedule(
300000L,
) {
eventsToDelete(database)
}
object : TimerTask() {
override fun run() {
eventsToDelete(database)
}
},
0,
300000,
)

val intentFilter = IntentFilter("com.example.ACTION_COPY")

Expand Down

0 comments on commit cb39eec

Please sign in to comment.