Skip to content

Commit

Permalink
fix: update log references to onStart onStop
Browse files Browse the repository at this point in the history
  • Loading branch information
travishaagen committed Oct 6, 2024
1 parent 76ebb7a commit 9808b73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/com/onepeloton/locust4k/LocustWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ class LocustWorker(
try {
taskInstance.beforeExecuteLoop(taskContext)
} catch (e: CancellationException) {
logger.info { "Task (${taskInstance.name()}) cancelled (onStart)" }
logger.info { "Task (${taskInstance.name()}) cancelled (beforeExecuteLoop)" }
return@launch
} catch (e: Exception) {
logger.error(e) { "Task (${taskInstance.name()}) onStart exception caught" }
stats.failure(0, e.message ?: "", taskInstance.name(), "onStart")
logger.error(e) { "Task (${taskInstance.name()}) beforeExecuteLoop exception caught" }
stats.failure(0, e.message ?: "", taskInstance.name(), "beforeExecuteLoop")
return@launch
}
try {
Expand All @@ -360,9 +360,9 @@ class LocustWorker(
try {
taskInstance.afterExecuteLoop(taskContext)
} catch (e: CancellationException) {
logger.info { "Task (${taskInstance.name()}) cancelled (onStop)" }
logger.info { "Task (${taskInstance.name()}) cancelled (afterExecuteLoop)" }
} catch (e: Exception) {
logger.warn(e) { "Task (${taskInstance.name()}) onStop exception caught" }
logger.warn(e) { "Task (${taskInstance.name()}) afterExecuteLoop exception caught" }
}
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ private class ExampleLocustTask : LocustTask {
override fun name(): String = "exampleTask"

override suspend fun beforeExecuteLoop(context: CoroutineContext) {
logger.info { "onStart invoked" }
logger.info { "beforeExecuteLoop invoked" }
}

override suspend fun afterExecuteLoop(context: CoroutineContext) {
logger.info { "onStop invoked" }
logger.info { "afterExecuteLoop invoked" }
}

override suspend fun execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class ExampleAppTest : TestcontainersBase() {
"Spawn message from controller",
"Stats reset",
"+1 (-0) user-units",
"onStart invoked",
"beforeExecuteLoop invoked",
"Spawning Complete",
"Quit message",
"Task (exampleTask) cancelled",
"onStop invoked",
"afterExecuteLoop invoked",
"Stats consumer stopped",
"Stats reporter stopped",
"Shutting down Locust Worker",
Expand Down

0 comments on commit 9808b73

Please sign in to comment.