override fun handle()

in plugin-bazel-event-service/src/main/kotlin/bazel/handlers/grpc/ComponentStreamFinishedHandler.kt [14:49]


    override fun handle(ctx: GrpcEventHandlerContext): Boolean {
        if (!ctx.event.hasComponentStreamFinished()) {
            return false
        }

        if (!ctx.verbosity.atLeast(Verbosity.Normal)) {
            return true
        }

        val componentStreamFinished = ctx.event.componentStreamFinished
        val component = formatComponent(ctx.streamId.component)
        when (componentStreamFinished.type) {
            FINISHED ->
                if (ctx.verbosity.atLeast(Verbosity.Verbose)) {
                    val text =
                        "Component \"$component\" stream finished".apply(Color.BuildStage) +
                            ", invocation: \"${ctx.streamId.invocationId}\", build: \"${ctx.streamId.buildId}\""
                    ctx.writer.message(text)
                }

            EXPIRED -> {
                ctx.writer.message(
                    buildString {
                        append("Component \"$component\" stream expired".apply(Color.Warning))
                        if (ctx.verbosity.atLeast(Verbosity.Verbose)) {
                            append(", invocation: \"${ctx.streamId.invocationId}\", build: \"${ctx.streamId.buildId}\"")
                        }
                    },
                )
            }

            else -> {}
        }

        return true
    }