Skip to content

Commit ff77c5b

Browse files
authored
Reduce the time to get the list by meeting code to save performance.
1 parent 1d4c6ed commit ff77c5b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tinystruct/examples/smalltalk.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ public String update() throws ApplicationException, IOException {
213213
public String update(String meetingCode, String sessionId) throws ApplicationException, IOException {
214214
String error = "{ \"error\": \"expired\" }";
215215
if (this.meetings.containsKey(meetingCode)) {
216-
if(sessions.get(meetingCode) != null && sessions.get(meetingCode).contains(sessionId)) {
216+
List<String> list;
217+
if((list = sessions.get(meetingCode)) != null && list.contains(sessionId)) {
217218
return this.update(sessionId);
218219
}
219220
error = "{ \"error\": \"session-timeout\" }";
@@ -330,7 +331,7 @@ public void sessionDestroyed(HttpSessionEvent arg0) {
330331

331332
Queue<Builder> messages;
332333
List<String> session_ids;
333-
synchronized (this.meetings) {
334+
synchronized (this.meetings) {
334335
if((session_ids = this.sessions.get(meetingCode)) != null) {
335336
session_ids.remove(arg0.getSession().getId());
336337
}

0 commit comments

Comments
 (0)