From 4d27b460ae2c55033a0dcf265a1fd8fef7911e9a Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Wed, 23 Sep 2015 22:31:15 +0000 Subject: [PATCH] - expire redis keys for events that are stored even if meeting is not recorded --- .../app/video/EventRecordingService.java | 13 +++++++++++-- .../deskshare/server/recorder/EventRecorder.java | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) mode change 100644 => 100755 deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/recorder/EventRecorder.java diff --git a/bbb-video/src/main/java/org/bigbluebutton/app/video/EventRecordingService.java b/bbb-video/src/main/java/org/bigbluebutton/app/video/EventRecordingService.java index c3ceef0598..05e594aafd 100755 --- a/bbb-video/src/main/java/org/bigbluebutton/app/video/EventRecordingService.java +++ b/bbb-video/src/main/java/org/bigbluebutton/app/video/EventRecordingService.java @@ -37,7 +37,16 @@ public class EventRecordingService { public void record(String meetingId, Map event) { Jedis jedis = new Jedis(host, port); Long msgid = jedis.incr("global:nextRecordedMsgId"); - jedis.hmset("recording:" + meetingId + COLON + msgid, event); - jedis.rpush("meeting:" + meetingId + COLON + "recordings", msgid.toString()); + String key = "recording:" + meetingId + COLON + msgid; + jedis.hmset(key, event); + /** + * We set the key to expire after 14 days as we are still + * recording the event into redis even if the meeting is not + * recorded. (ralam sept 23, 2015) + */ + jedis.expire(key, 14*24*60*60 /*14days*/); + key = "meeting:" + meetingId + COLON + "recordings"; + jedis.rpush(key, msgid.toString()); + jedis.expire(key, 14*24*60*60 /*14days*/); } } diff --git a/deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/recorder/EventRecorder.java b/deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/recorder/EventRecorder.java old mode 100644 new mode 100755 index 9cd9686ee6..2df5ef806d --- a/deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/recorder/EventRecorder.java +++ b/deskshare/app/src/main/java/org/bigbluebutton/deskshare/server/recorder/EventRecorder.java @@ -19,14 +19,13 @@ package org.bigbluebutton.deskshare.server.recorder; import java.util.concurrent.TimeUnit; - import org.bigbluebutton.deskshare.server.recorder.event.AbstractDeskshareRecordEvent; import org.bigbluebutton.deskshare.server.recorder.event.RecordEvent; import org.bigbluebutton.deskshare.server.recorder.event.RecordStartedEvent; import org.bigbluebutton.deskshare.server.recorder.event.RecordStoppedEvent; - import redis.clients.jedis.Jedis; + public class EventRecorder implements RecordStatusListener { private static final String COLON=":"; private String host; @@ -44,8 +43,17 @@ public class EventRecorder implements RecordStatusListener { private void record(String session, RecordEvent message) { Jedis jedis = new Jedis(host, port); Long msgid = jedis.incr("global:nextRecordedMsgId"); - jedis.hmset("recording" + COLON + session + COLON + msgid, message.toMap()); - jedis.rpush("meeting" + COLON + session + COLON + "recordings", msgid.toString()); + String key = "recording" + COLON + session + COLON + msgid; + jedis.hmset(key, message.toMap()); + /** + * We set the key to expire after 14 days as we are still + * recording the event into redis even if the meeting is not + * recorded. (ralam sept 23, 2015) + */ + jedis.expire(key, 14*24*60*60 /*14days*/); + key = "meeting" + COLON + session + COLON + "recordings"; + jedis.rpush(key, msgid.toString()); + jedis.expire(key, 14*24*60*60 /*14days*/); } @Override