Просмотр исходного кода

Merge pull request #1596 from sharelatex/ja-more-client-error-logging

Increase the number and type of events we log

GitOrigin-RevId: 5384beb86f095d673deebe7b17d76668137fc912
Timothée Alby 7 лет назад
Родитель
Сommit
5b5b06307a
2 измененных файлов с 17 добавлено и 2 удалено
  1. 16 1
      services/web/public/src/ide/editor/Document.js
  2. 1 1
      services/web/public/src/ide/services/ide.js

+ 16 - 1
services/web/public/src/ide/editor/Document.js

@@ -395,7 +395,8 @@ define([
           doc_id: this.doc_id,
           doc_id: this.doc_id,
           remote_doc_id: update != null ? update.doc : undefined,
           remote_doc_id: update != null ? update.doc : undefined,
           wantToBeJoined: this.wantToBeJoined,
           wantToBeJoined: this.wantToBeJoined,
-          update
+          update,
+          hasDoc: (this.doc != null)
         })
         })
 
 
         if (
         if (
@@ -420,6 +421,9 @@ define([
           (update != null ? update.doc : undefined) === this.doc_id &&
           (update != null ? update.doc : undefined) === this.doc_id &&
           this.doc != null
           this.doc != null
         ) {
         ) {
+          this.ide.pushEvent('received-update:processing', {
+            update
+          })
           this.doc.processUpdateFromServer(update)
           this.doc.processUpdateFromServer(update)
 
 
           if (!this.wantToBeJoined) {
           if (!this.wantToBeJoined) {
@@ -476,6 +480,10 @@ define([
           callback = function(error) {}
           callback = function(error) {}
         }
         }
         if (this.doc != null) {
         if (this.doc != null) {
+          this.ide.pushEvent('joinDoc:existing', {
+            doc_id: this.doc_id,
+            version: this.doc.getVersion()
+          })
           return this.ide.socket.emit(
           return this.ide.socket.emit(
             'joinDoc',
             'joinDoc',
             this.doc_id,
             this.doc_id,
@@ -496,6 +504,9 @@ define([
             }
             }
           )
           )
         } else {
         } else {
+          this.ide.pushEvent('joinDoc:new', {
+            doc_id: this.doc_id
+          })
           return this.ide.socket.emit(
           return this.ide.socket.emit(
             'joinDoc',
             'joinDoc',
             this.doc_id,
             this.doc_id,
@@ -505,6 +516,10 @@ define([
                 return callback(error)
                 return callback(error)
               }
               }
               this.joined = true
               this.joined = true
+              this.ide.pushEvent('joinDoc:inited', {
+                doc_id: this.doc_id,
+                version
+              })
               this.doc = new ShareJsDoc(
               this.doc = new ShareJsDoc(
                 this.doc_id,
                 this.doc_id,
                 docLines,
                 docLines,

+ 1 - 1
services/web/public/src/ide/services/ide.js

@@ -37,7 +37,7 @@ define(['base'], function(App) {
           meta = {}
           meta = {}
         }
         }
         this.recentEvents.push({ type, meta, date: new Date() })
         this.recentEvents.push({ type, meta, date: new Date() })
-        if (this.recentEvents.length > 40) {
+        if (this.recentEvents.length > 100) {
           return this.recentEvents.shift()
           return this.recentEvents.shift()
         }
         }
       }
       }