UTC + new version
This commit is contained in:
parent
c5ab426e23
commit
4eb19a51c4
@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
eventi = "1.0-rc26"
|
eventi = "1.0-rc27"
|
||||||
exfl = "1.0-rc1"
|
exfl = "1.0-rc1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import java.io.FileInputStream
|
|||||||
import java.io.RandomAccessFile
|
import java.io.RandomAccessFile
|
||||||
import java.net.InetAddress
|
import java.net.InetAddress
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
|
import java.time.Clock
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.zip.CRC32
|
import java.util.zip.CRC32
|
||||||
|
|
||||||
@ -218,3 +219,7 @@ fun File.resolveConflict(): File {
|
|||||||
|
|
||||||
val LocalDateTimeEpoch: LocalDateTime =
|
val LocalDateTimeEpoch: LocalDateTime =
|
||||||
LocalDateTime.of(1970, 1, 1, 0, 0, 0)
|
LocalDateTime.of(1970, 1, 1, 0, 0, 0)
|
||||||
|
|
||||||
|
fun UtcNow(): LocalDateTime {
|
||||||
|
return LocalDateTime.now(Clock.systemUTC())
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import no.iktdev.eventi.ZDS
|
|||||||
import no.iktdev.eventi.models.Event
|
import no.iktdev.eventi.models.Event
|
||||||
import no.iktdev.eventi.models.store.PersistedEvent
|
import no.iktdev.eventi.models.store.PersistedEvent
|
||||||
import no.iktdev.eventi.stores.EventStore
|
import no.iktdev.eventi.stores.EventStore
|
||||||
|
import no.iktdev.mediaprocessing.shared.common.UtcNow
|
||||||
import no.iktdev.mediaprocessing.shared.database.tables.EventsTable
|
import no.iktdev.mediaprocessing.shared.database.tables.EventsTable
|
||||||
import no.iktdev.mediaprocessing.shared.database.withTransaction
|
import no.iktdev.mediaprocessing.shared.database.withTransaction
|
||||||
import org.jetbrains.exposed.sql.insert
|
import org.jetbrains.exposed.sql.insert
|
||||||
@ -59,7 +60,7 @@ object EventStore: EventStore {
|
|||||||
it[EventsTable.eventId] = event.eventId.toString()
|
it[EventsTable.eventId] = event.eventId.toString()
|
||||||
it[EventsTable.event] = eventName
|
it[EventsTable.event] = eventName
|
||||||
it[EventsTable.data] = asData
|
it[EventsTable.data] = asData
|
||||||
it[EventsTable.persistedAt] = LocalDateTime.now()
|
it[EventsTable.persistedAt] = UtcNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,12 +5,12 @@ import no.iktdev.eventi.models.Task
|
|||||||
import no.iktdev.eventi.models.store.PersistedTask
|
import no.iktdev.eventi.models.store.PersistedTask
|
||||||
import no.iktdev.eventi.models.store.TaskStatus
|
import no.iktdev.eventi.models.store.TaskStatus
|
||||||
import no.iktdev.eventi.stores.TaskStore
|
import no.iktdev.eventi.stores.TaskStore
|
||||||
|
import no.iktdev.mediaprocessing.shared.common.UtcNow
|
||||||
import no.iktdev.mediaprocessing.shared.common.dto.PagedTasks
|
import no.iktdev.mediaprocessing.shared.common.dto.PagedTasks
|
||||||
import no.iktdev.mediaprocessing.shared.database.tables.TasksTable
|
import no.iktdev.mediaprocessing.shared.database.tables.TasksTable
|
||||||
import no.iktdev.mediaprocessing.shared.database.withTransaction
|
import no.iktdev.mediaprocessing.shared.database.withTransaction
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object TaskStore: TaskStore {
|
object TaskStore: TaskStore {
|
||||||
@ -59,7 +59,7 @@ object TaskStore: TaskStore {
|
|||||||
it[TasksTable.task] = taskName
|
it[TasksTable.task] = taskName
|
||||||
it[status] = TaskStatus.Pending
|
it[status] = TaskStatus.Pending
|
||||||
it[data] = asData
|
it[data] = asData
|
||||||
it[persistedAt] = LocalDateTime.now()
|
it[persistedAt] = UtcNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ object TaskStore: TaskStore {
|
|||||||
}) {
|
}) {
|
||||||
it[claimed] = true
|
it[claimed] = true
|
||||||
it[claimedBy] = workerId
|
it[claimedBy] = workerId
|
||||||
it[lastCheckIn] = LocalDateTime.now()
|
it[lastCheckIn] = UtcNow()
|
||||||
}
|
}
|
||||||
}.isSuccess
|
}.isSuccess
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ object TaskStore: TaskStore {
|
|||||||
override fun heartbeat(taskId: UUID) {
|
override fun heartbeat(taskId: UUID) {
|
||||||
withTransaction {
|
withTransaction {
|
||||||
TasksTable.update({ TasksTable.taskId eq taskId.toString() }) {
|
TasksTable.update({ TasksTable.taskId eq taskId.toString() }) {
|
||||||
it[lastCheckIn] = LocalDateTime.now()
|
it[lastCheckIn] = UtcNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ object TaskStore: TaskStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun releaseExpiredTasks(timeout: Duration) {
|
override fun releaseExpiredTasks(timeout: Duration) {
|
||||||
val now = LocalDateTime.now()
|
val now = UtcNow()
|
||||||
val expirationTime = now.minus(timeout)
|
val expirationTime = now.minus(timeout)
|
||||||
withTransaction {
|
withTransaction {
|
||||||
TasksTable.update({
|
TasksTable.update({
|
||||||
|
|||||||
@ -7,9 +7,9 @@ import no.iktdev.exfl.using
|
|||||||
import no.iktdev.mediaprocessing.ffmpeg.arguments.MpegArgument
|
import no.iktdev.mediaprocessing.ffmpeg.arguments.MpegArgument
|
||||||
import no.iktdev.mediaprocessing.ffmpeg.decoder.FfmpegDecodedProgress
|
import no.iktdev.mediaprocessing.ffmpeg.decoder.FfmpegDecodedProgress
|
||||||
import no.iktdev.mediaprocessing.ffmpeg.decoder.FfmpegProgressDecoder
|
import no.iktdev.mediaprocessing.ffmpeg.decoder.FfmpegProgressDecoder
|
||||||
|
import no.iktdev.mediaprocessing.ffmpeg.util.UtcNow
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
open class FFmpeg(val executable: String, val logDir: File) {
|
open class FFmpeg(val executable: String, val logDir: File) {
|
||||||
@ -20,7 +20,7 @@ open class FFmpeg(val executable: String, val logDir: File) {
|
|||||||
private val outputCache = mutableListOf<String>()
|
private val outputCache = mutableListOf<String>()
|
||||||
|
|
||||||
//region Log File formatting
|
//region Log File formatting
|
||||||
val currentDateTime = LocalDateTime.now()
|
val currentDateTime = UtcNow()
|
||||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd.HH.mm")
|
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd.HH.mm")
|
||||||
val formattedDateTime = currentDateTime.format(formatter)
|
val formattedDateTime = currentDateTime.format(formatter)
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
package no.iktdev.mediaprocessing.ffmpeg.util
|
||||||
|
|
||||||
|
import java.time.Clock
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
fun UtcNow(): LocalDateTime {
|
||||||
|
return LocalDateTime.now(Clock.systemUTC())
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user