mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
[headless] only offload to DatabaseExecutor when needed
when receiving a new conversation message
This commit is contained in:
@@ -81,9 +81,9 @@ constructor(
|
|||||||
|
|
||||||
override fun eventOccurred(e: Event) {
|
override fun eventOccurred(e: Event) {
|
||||||
when (e) {
|
when (e) {
|
||||||
is ConversationMessageReceivedEvent<*> -> dbExecutor.execute {
|
is ConversationMessageReceivedEvent<*> -> {
|
||||||
val h = e.messageHeader
|
val h = e.messageHeader
|
||||||
if (h is PrivateMessageHeader) {
|
if (h is PrivateMessageHeader) dbExecutor.execute {
|
||||||
val text = messagingManager.getMessageText(h.id)
|
val text = messagingManager.getMessageText(h.id)
|
||||||
webSocketController.sendEvent(EVENT_CONVERSATION_MESSAGE, e.output(text))
|
webSocketController.sendEvent(EVENT_CONVERSATION_MESSAGE, e.output(text))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -69,8 +69,6 @@ internal class WebSocketControllerTest : ControllerTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIntroductionRequestEvent() {
|
fun testIntroductionRequestEvent() {
|
||||||
val sessionId = SessionId(getRandomId())
|
|
||||||
val authorInfo = AuthorInfo(VERIFIED)
|
|
||||||
val introductionRequest = IntroductionRequest(
|
val introductionRequest = IntroductionRequest(
|
||||||
message.id,
|
message.id,
|
||||||
group.id,
|
group.id,
|
||||||
@@ -79,11 +77,11 @@ internal class WebSocketControllerTest : ControllerTest() {
|
|||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
sessionId,
|
SessionId(getRandomId()),
|
||||||
author,
|
author,
|
||||||
text,
|
text,
|
||||||
false,
|
false,
|
||||||
authorInfo
|
AuthorInfo(VERIFIED)
|
||||||
)
|
)
|
||||||
val introductionRequestEvent =
|
val introductionRequestEvent =
|
||||||
IntroductionRequestReceivedEvent(introductionRequest, contact.id)
|
IntroductionRequestReceivedEvent(introductionRequest, contact.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user