Skip to content

Commit ffe3f12

Browse files
committed
more updatez
1 parent 7fbf852 commit ffe3f12

2 files changed

Lines changed: 24 additions & 16 deletions

File tree

‎v3/js/opt-frontend.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ var tutorAvailable = false;
7979
var origDocURL = document.URL; // capture this ASAP before TogetherJS munges the URL
8080

8181
var tutorWaitText = 'Please wait for the next available tutor.';
82-
var informedConsentText = '<div style="color: #666;">During shared sessions, chat logs and code may be recorded and published for<br/>educational purposes. Do not reveal any private or confidential information.</div>';
82+
var informedConsentText = '<div style="font-size: 8pt; color: #666;">During shared sessions, chat logs and code may be recorded and published for<br/>research and education. Please do not reveal any private or sensitive information.</div>';
8383

8484
// nasty globals
8585
var updateOutputSignalFromRemote = false;
@@ -314,7 +314,7 @@ function initTogetherJS() {
314314
myVisualizer.domRoot.find('#pyCodeOutputDiv').scrollTop(msg.pyCodeOutputDivScrollTop);
315315
}
316316
}
317-
else {
317+
else if (!isExecutingCode) { // if already executing from a prior signal, ignore
318318
console.log("on:myAppState - app states unequal, executing", learnerAppState);
319319
syncAppState(learnerAppState);
320320

@@ -331,6 +331,7 @@ function initTogetherJS() {
331331
}
332332
}
333333
else {
334+
assert(learnerAppState.mode == 'edit');
334335
if (!appStateEq(getAppState(), learnerAppState)) {
335336
console.log("on:myAppState - edit mode sync");
336337
syncAppState(learnerAppState);
@@ -429,7 +430,7 @@ function initTogetherJS() {
429430
$("#togetherjsURL").val(urlToShare).attr('size', urlToShare.length + 25);
430431
}
431432

432-
$("#togetherjsStatus").append(informedConsentText).fadeIn(500);
433+
$("#togetherjsStatus").append(informedConsentText).show();
433434
});
434435

435436
// emitted when TogetherJS is closed. This is not emitted when the

‎v3/opt_togetherjs/server.js‎

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,15 @@ wsServer.on('request', function(request) {
320320
' conn ID: ' + connection.ID + ' data:' + message.utf8Data.substr(0, 20) +
321321
' connections: ' + allConnections[id].length);
322322

323-
// ignore some kinds of extraneous events
323+
// ignore some kinds of extraneous noisy events
324324
if (parsed.type != 'cursor-update' &&
325325
parsed.type != 'scroll-update' &&
326326
parsed.type != 'keydown' &&
327327
parsed.type != 'form-init' &&
328328
parsed.type != 'form-focus' &&
329329
parsed.type != 'form-update' &&
330-
parsed.type != 'hello-back'
330+
parsed.type != 'hello-back' &&
331+
parsed.type != 'app.codemirror-edit'
331332
) {
332333
var logObj = createLogEntry(request, 'help-available');
333334
logObj.id = id;
@@ -495,10 +496,6 @@ function createLogEntry(req, event_type) {
495496
// pgbovine - TogetherJS administrator hub
496497

497498
var pgLogFile = null;
498-
var catchallLogFile = fs.createWriteStream('log_CATCHALL.json',
499-
{flags: 'a',
500-
mode: parseInt('644', 8),
501-
encoding: "UTF-8"});
502499

503500
var EventEmitter = require('events').EventEmitter;
504501
var learnerEmitter = new EventEmitter(); // sending events to learners
@@ -511,18 +508,28 @@ adminEmitter.setMaxListeners(100);
511508
var helpQueue = [];
512509
var helpAvailable = false;
513510

511+
var MAX_LOG_SIZE = 10000;
512+
var curLogSize = 0;
513+
514514
function pgLogWrite(logObj) {
515515
var s = JSON.stringify(logObj);
516516
//console.log(s); // debug
517517

518-
if (pgLogFile) {
519-
pgLogFile.write(s + '\n');
520-
}
521-
else {
522-
// a slush of everything that's not covered by a real log file, to
523-
// see what falls between the cracks
524-
catchallLogFile.write(s + '\n');
518+
// rotate log every MAX_LOG_SIZE entries
519+
if (!pgLogFile || curLogSize >= MAX_LOG_SIZE) {
520+
if (pgLogFile) {
521+
pgLogFile.end();
522+
}
523+
var filename = 'log_' + logObj.date + '.json';
524+
pgLogFile = fs.createWriteStream(filename,
525+
{flags: 'w',
526+
mode: parseInt('644', 8),
527+
encoding: "UTF-8"});
528+
curLogSize = 0;
525529
}
530+
531+
pgLogFile.write(s + '\n');
532+
curLogSize++;
526533
}
527534

528535
function toggleHelpAvailable(req, res) {

0 commit comments

Comments
 (0)