-
Notifications
You must be signed in to change notification settings - Fork 841
Fixes #4948 | Lazy event parsing #4986
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package mesosphere.marathon.core.event | ||
|
||
import akka.event.EventStream | ||
import com.fasterxml.jackson.annotation.JsonIgnore | ||
import mesosphere.marathon.api.v2.json.Formats.eventToJson | ||
import mesosphere.marathon.core.condition.Condition | ||
import mesosphere.marathon.core.health.HealthCheck | ||
import mesosphere.marathon.core.instance.update.InstanceChange | ||
|
@@ -9,12 +11,15 @@ import mesosphere.marathon.core.instance.Instance | |
import mesosphere.marathon.state.{ AppDefinition, PathId, Timestamp } | ||
import mesosphere.marathon.upgrade.{ DeploymentPlan, DeploymentStep } | ||
import org.apache.mesos.{ Protos => Mesos } | ||
import play.api.libs.json.Json | ||
|
||
import scala.collection.immutable.Seq | ||
|
||
sealed trait MarathonEvent { | ||
val eventType: String | ||
val timestamp: String | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could have all of these have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry I don't understand. If you are referring to put There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry for forgetting about this... since we control the serialization/deserialization of these, we could have the jsonString as a member and not serialize the field. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
@JsonIgnore | ||
lazy val jsonString: String = Json.stringify(eventToJson(this)) | ||
} | ||
|
||
// api | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,9 @@ import java.io.EOFException | |
import akka.actor.{ Actor, ActorLogging, Status } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you change the package into a double declaration? e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
import akka.event.EventStream | ||
import akka.pattern.pipe | ||
import mesosphere.marathon.api.v2.json.Formats._ | ||
import mesosphere.marathon.core.event.impl.stream.HttpEventStreamHandleActor._ | ||
import mesosphere.marathon.core.event.{ EventStreamAttached, EventStreamDetached, MarathonEvent } | ||
import mesosphere.util.ThreadPoolContext | ||
import play.api.libs.json.Json | ||
|
||
import scala.concurrent.Future | ||
import scala.util.Try | ||
|
@@ -60,7 +58,7 @@ class HttpEventStreamHandleActor( | |
outstanding = List.empty[MarathonEvent] | ||
context.become(stashEvents) | ||
val sendFuture = Future { | ||
toSend.foreach(event => handle.sendEvent(event.eventType, Json.stringify(eventToJson(event)))) | ||
toSend.foreach(event => handle.sendEvent(event)) | ||
WorkDone | ||
}(ThreadPoolContext.ioContext) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you double package this too?