kopia lustrzana https://github.com/c9/core
Sending error if watcher detects a file change but collab doesn't pick up on it somehow
rodzic
911a45f052
commit
41d0114f73
|
@ -67,7 +67,7 @@
|
|||
"c9.ide.language.javascript.tern": "#2b0bb024da",
|
||||
"c9.ide.language.javascript.infer": "#cfec494a3c",
|
||||
"c9.ide.language.jsonalyzer": "#ba3e0d298c",
|
||||
"c9.ide.collab": "#ca8cc53a66",
|
||||
"c9.ide.collab": "#6d1ce4ec15",
|
||||
"c9.ide.local": "#a9703b630c",
|
||||
"c9.ide.find": "#6cc6d3379d",
|
||||
"c9.ide.find.infiles": "#72582de3cd",
|
||||
|
|
|
@ -15,6 +15,7 @@ define(function(require, module, exports) {
|
|||
title, tooltip, amlTab, closed, rule, docInited;
|
||||
|
||||
var meta = {};
|
||||
var debugData = {};
|
||||
var name = options.name;
|
||||
|
||||
var classList = {
|
||||
|
@ -355,6 +356,13 @@ define(function(require, module, exports) {
|
|||
* @property {Object} meta
|
||||
*/
|
||||
get meta(){ return meta; },
|
||||
|
||||
/**
|
||||
* Data for debugging issues and errors with tabs
|
||||
* @property {Object} debugData
|
||||
*/
|
||||
get debugData(){ return debugData; },
|
||||
|
||||
/**
|
||||
* The path to the file loaded into this tab. This property will
|
||||
* be undefined when no path is set (for instance when no file
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define(function(require, exports, module) {
|
||||
main.consumes = [
|
||||
"Plugin", "fs", "settings", "preferences", "watcher", "tabManager",
|
||||
"save", "dialog.question", "dialog.filechange", "threewaymerge"
|
||||
"save", "dialog.question", "dialog.filechange", "threewaymerge", "error_handler"
|
||||
];
|
||||
main.provides = ["watcher.gui"];
|
||||
return main;
|
||||
|
@ -17,6 +17,7 @@ define(function(require, exports, module) {
|
|||
var question = imports["dialog.question"];
|
||||
var filechange = imports["dialog.filechange"];
|
||||
var threeWayMerge = imports.threewaymerge.merge;
|
||||
var errorHandler = imports.error_handler;
|
||||
|
||||
var collabEnabled = options.collab;
|
||||
|
||||
|
@ -127,6 +128,23 @@ define(function(require, exports, module) {
|
|||
// Collab is supposed to handle this change
|
||||
// TODO make this a setting
|
||||
console.warn("[watchers] change ignored because of Collab", e.path);
|
||||
/* If the lastChange (added by collab) was greater than 1 second ago set up a watch
|
||||
To ensure that collab makes this change, if not report an error. The lastChange
|
||||
check is to avoid a race condition if collab updates before this function runs */
|
||||
if (!tab.debugData.lastChange || tab.debugData.lastChange < (Date.now() - 1000)) {
|
||||
if (tab.debugData.changeRegistered) {
|
||||
clearTimeout(tab.debugData.changeRegistered);
|
||||
}
|
||||
tab.debugData.changeRegistered = setTimeout(function() {
|
||||
errorHandler.reportError(new Error("Watcher picked up file change but collab didn't apply it"), {
|
||||
active: tab.active,
|
||||
state: tab.getState(),
|
||||
collabEnabled: collabEnabled,
|
||||
lastChange: tab.debugData.lastChange,
|
||||
currentTime: Date.now(),
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue