Skip to content

Commit

Permalink
Add missing fields on task status (#2779)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvim authored Dec 1, 2022
1 parent eeadf00 commit 29c4aef
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
package com.sksamuel.elastic4s.requests.task

case class TaskStatus(total: Long, updated: Long, created: Long, deleted: Long, batches: Long)
import com.fasterxml.jackson.annotation.JsonProperty

import scala.concurrent.duration.{DurationLong, FiniteDuration}

case class TaskStatus(
total: Long,
updated: Long,
created: Long,
deleted: Long,
batches: Long,
@JsonProperty("version_conflicts") private val version_conflicts: Long,
noops: Long,
retries : Retries,
@JsonProperty("throttled_millis") private val throttled_millis: Long
) {
def versionConflicts: Long = version_conflicts

def throttledTime: FiniteDuration = throttled_millis.millis
}

case class Retries(bulk: Long, search: Long)
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.sksamuel.elastic4s.tasks

import com.sksamuel.elastic4s.requests.common.RefreshPolicy
import com.sksamuel.elastic4s.requests.task.Retries
import com.sksamuel.elastic4s.testkit.DockerTests
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

import scala.concurrent.duration.DurationInt

class GetTaskTest extends AnyWordSpec with Matchers with DockerTests {

cleanIndex("get_task_a")
Expand Down Expand Up @@ -40,6 +43,10 @@ class GetTaskTest extends AnyWordSpec with Matchers with DockerTests {
task.action shouldBe "indices:data/write/reindex"
task.description shouldBe "reindex from [get_task_a] to [get_task_b]"
task.startTimeInMillis >= start shouldBe true
task.status.versionConflicts should be(0)
task.status.throttledTime should be(0.millis)
task.status.noops should be(0)
task.status.retries should be(Retries(0, 0))
}
}
}
Expand Down

0 comments on commit 29c4aef

Please sign in to comment.