Minor tweaks
This commit is contained in:
parent
29923771fd
commit
534400c738
@ -2,10 +2,7 @@ package no.iktdev.mediaprocessing.coordinator.controller
|
|||||||
|
|
||||||
import no.iktdev.mediaprocessing.coordinator.services.EventPagingService
|
import no.iktdev.mediaprocessing.coordinator.services.EventPagingService
|
||||||
import no.iktdev.mediaprocessing.shared.common.dto.SequenceEvent
|
import no.iktdev.mediaprocessing.shared.common.dto.SequenceEvent
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -14,9 +11,10 @@ class EventsController(
|
|||||||
private val paging: EventPagingService
|
private val paging: EventPagingService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
|
@GetMapping("/sequence/{referenceId}")
|
||||||
fun getEvents(
|
fun getEvents(
|
||||||
@RequestParam referenceId: UUID,
|
@PathVariable referenceId: UUID,
|
||||||
@RequestParam(required = false) beforeEventId: UUID?,
|
@RequestParam(required = false) beforeEventId: UUID?,
|
||||||
@RequestParam(required = false) afterEventId: UUID?,
|
@RequestParam(required = false) afterEventId: UUID?,
|
||||||
@RequestParam(defaultValue = "50") limit: Int
|
@RequestParam(defaultValue = "50") limit: Int
|
||||||
|
|||||||
@ -59,7 +59,7 @@ def fetch_next_task(db: Database) -> Optional[MetadataSearchTask]:
|
|||||||
def mark_failed(db: Database, task_id: str) -> None:
|
def mark_failed(db: Database, task_id: str) -> None:
|
||||||
cursor = db.conn.cursor()
|
cursor = db.conn.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"UPDATE TASKS SET STATUS='Failed' WHERE TASK_ID=%s",
|
"UPDATE TASKS SET STATUS='Failed', CLAIMED=1, CONSUMED=1 WHERE TASK_ID=%s",
|
||||||
(task_id,)
|
(task_id,)
|
||||||
)
|
)
|
||||||
db.conn.commit()
|
db.conn.commit()
|
||||||
|
|||||||
@ -49,7 +49,7 @@ def run_iteration(db: Database, worker_id: str, poll_interval: int) -> tuple[int
|
|||||||
|
|
||||||
def run_worker(db: Database, shutdown_flag_ref=lambda: False, heartbeat_ref=None) -> None:
|
def run_worker(db: Database, shutdown_flag_ref=lambda: False, heartbeat_ref=None) -> None:
|
||||||
poll_interval: int = 5
|
poll_interval: int = 5
|
||||||
worker_id = f"worker-{uuid.uuid4()}"
|
worker_id = f"PyMetadata-{uuid.uuid4()}"
|
||||||
|
|
||||||
while not shutdown_flag_ref():
|
while not shutdown_flag_ref():
|
||||||
if heartbeat_ref:
|
if heartbeat_ref:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user