Skip to content
Snippets Groups Projects

Misc cleanups

Closed Clément Pit-Claudel requested to merge cpc/cleanup into cpc/single-port
2 unresolved threads

@lewolff could you have a look? This is very lightly tested.

And @vairoli if you could help with testing that would be great.

This should be merged after !20 (merged)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
39 32
40 33 /** Initialize an empty session list for the given app instance */
41 34 def initializeApp(instanceId: InstanceId) =
42 35 require(!sessions.contains(instanceId))
43 sessions(instanceId) = Seq.empty
44
45 /** Runs k with parameters parsed from the websocket connection path. [[k]] is
46 * run while synchronizing on [[sessions]]
47 *
48 * The connection should be on "ws://…/[app_instance_id]/[user_id]" for the
49 * parsing to function properly.
50 */
51 private def withSessionParams[T](socket: WebSocket)(k: (InstanceId, UserId) => T) =
36 sessions = sessions.updated(instanceId, Map.empty.withDefaultValue(Set.empty))
37
38 def shutdownApp(instanceId: InstanceId): Unit =
  • 47 *
    48 * The connection should be on "ws://…/[app_instance_id]/[user_id]" for the
    49 * parsing to function properly.
    50 */
    51 private def withSessionParams[T](socket: WebSocket)(k: (InstanceId, UserId) => T) =
    36 sessions = sessions.updated(instanceId, Map.empty.withDefaultValue(Set.empty))
    37
    38 def shutdownApp(instanceId: InstanceId): Unit =
    39 for by_client <- sessions.values
    40 channels <- by_client.values
    41 channel <- channels
    42 do
    43 channel.send(cask.Ws.Close())
    44 sessions = sessions - instanceId
    45
    46 def connect(instanceId: String, userId: String)
  • No additional comments other than locks

  • Léo Wolff requested changes

    requested changes

  • Actually since it includes the code from !20 (merged) , this review belongs to !20 (merged) rather than here I think.

  • Kacper Feliks Korban mentioned in merge request !20 (merged)

    mentioned in merge request !20 (merged)

  • Please register or sign in to reply
    Loading