Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Add status endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Feb 15, 2022
1 parent 4e3ca8a commit 0f77e0c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ intellijPluginVersion=1.3.0
javassistVersion=3.28.0-GA
kotlinVersion=1.6.10
mockitoKotlinVersion=4.0.0
projectorClientVersion=aeaf9989
projectorClientVersion=1b08e117
projectorClientGroup=com.github.JetBrains.projector-client
targetJvm=11
jetbrainsMonoVersion=2.242
Expand Down
6 changes: 6 additions & 0 deletions projector-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Unreleased

## Fixed

- PRJ-691 PRJ-750 PRJ-779 Fix JetBrains account login
- Infinite transport initialization on relay failure

## Changed

- Switch to JS IR compilation for projector-client-web

## Added

- Status endpoint

# 1.6.0

## Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,13 @@ class ProjectorServer private constructor(
return allEvents
}

private var lastUserActionTimeStampMs: Long = 0L

private fun processMessage(clientSettings: ReadyClientSettings, message: ClientEvent) {
if (message is ClientUserEvent) {
lastUserActionTimeStampMs = System.currentTimeMillis()
}

if (
!clientSettings.setUpClientData.hasWriteAccess &&
message !is ClientRequestImageDataEvent &&
Expand Down Expand Up @@ -700,8 +706,9 @@ class ProjectorServer private constructor(
fun start() {
updateThread = createUpdateThread()
caretInfoUpdater.start()
lastUserActionTimeStampMs = System.currentTimeMillis()

WebsocketServer.createTransportBuilders().forEach {
WebsocketServer.createTransportBuilders(getLastUserActionTimeStampMs = ::lastUserActionTimeStampMs).forEach {
addTransport(it.attachDefaultServerEventHandlers(clientEventHandler).build())
}
}
Expand Down Expand Up @@ -733,6 +740,7 @@ class ProjectorServer private constructor(
fun stop(timeout: Int = 0) {
transports.forEach { it.stop(timeout) }
transports.clear()
lastUserActionTimeStampMs = 0L
caretInfoUpdater.stop()

if (::updateThread.isInitialized) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import org.jetbrains.projector.server.service.ProjectorImageCacher
import org.jetbrains.projector.util.logging.Logger

object WebsocketServer {
internal fun createTransportBuilders(): List<WsTransportBuilder> {
internal fun createTransportBuilders(getLastUserActionTimeStampMs: () -> Long): List<WsTransportBuilder> {
val builders = arrayListOf<WsTransportBuilder>()

val relayUrl = getOption(RELAY_PROPERTY_NAME)
Expand Down Expand Up @@ -68,6 +68,7 @@ object WebsocketServer {
)
}
}
serverBuilder.getLastUserActionTimeStampMs = getLastUserActionTimeStampMs

builders.add(serverBuilder)
}
Expand Down

0 comments on commit 0f77e0c

Please sign in to comment.