Merge pull request #2803 from ritzalam/expire-redis-key

- expire redis keys for events that are stored even if meeting is no…
This commit is contained in:
Richard Alam 2015-09-23 18:33:08 -04:00
commit 49014d4b12
2 changed files with 23 additions and 6 deletions

View File

@ -37,7 +37,16 @@ public class EventRecordingService {
public void record(String meetingId, Map<String, String> 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*/);
}
}

View File

@ -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