Titanium JIRA Archive
Appcelerator Daemon (DAEMON)

[DAEMON-222] Plugin: Allow a plugin to register paths to be ignored

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusResolved
ResolutionFixed
Resolution Date2018-02-12T07:24:39.000+0000
Affected Version/sAppc Daemon 1.0.0, Appc Daemon 1.0.1
Fix Version/sAppc Daemon 1.1.0
Componentsappcd-plugin
Labelsn/a
ReporterEwan Harris
AssigneeEwan Harris
Created2018-01-17T15:16:31.000+0000
Updated2018-02-15T06:26:38.000+0000

Description

Description

Developing a plugin on Windows is a major pain due to the fswatcher we set up on a plugins directory, for example here is an example of where over a 13 second timespan my plugin would have been reloaded if not for a hack I added to prevent it, in my opinion we should only be reloading a plugin if the conf or dist folders have changed, but I can understand reasons for reloading otherwise.
2018-01-17T14:35:19.986Z appcd:core:status CPU:   ↓2.5%  Heap:  ↓36.35 MB /   42.75 MB  RSS:  ↓63.69 MB  Uptime: 0.99m
2018-01-17T14:35:21.631Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:21.634Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
  filename: '.git',
  file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:21.679Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:21.682Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
  filename: '.git',
  file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:21.827Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:21.888Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:21.991Z appcd:core:status CPU:   ↓2.4%  Heap:  ↑36.62 MB /   42.75 MB  RSS:  ↑63.93 MB  Uptime: 1.02m
2018-01-17T14:35:23.993Z appcd:core:status CPU:   ↓2.3%  Heap:  ↑36.78 MB /   42.75 MB  RSS:  ↑64.09 MB  Uptime: 1.06m
2018-01-17T14:35:25.998Z appcd:core:status CPU:    2.3%  Heap:  ↑36.95 MB /   42.75 MB  RSS:  ↑64.25 MB  Uptime: 1.09m
2018-01-17T14:35:26.926Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:26.928Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
  filename: '.git',
  file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:26.973Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:26.975Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
  filename: '.git',
  file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:27.162Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:27.225Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:28.001Z appcd:core:status CPU:   ↓2.2%  Heap:  ↓36.30 MB /   42.75 MB  RSS:  ↓63.60 MB  Uptime: 1.12m
2018-01-17T14:35:30.003Z appcd:core:status CPU:   ↓2.1%  Heap:  ↑36.47 MB /   42.75 MB  RSS:  ↑63.77 MB  Uptime: 1.16m
2018-01-17T14:35:32.007Z appcd:core:status CPU:    2.1%  Heap:  ↑36.65 MB /   42.75 MB  RSS:  ↑63.95 MB  Uptime: 1.19m
2018-01-17T14:35:32.227Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:32.229Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
  filename: '.git',
  file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:32.274Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
2018-01-17T14:35:32.275Z appcd:fswatcher Notifying 1 watcher: C:\Users\ewan\Documents\git\appcd-plugin-windows → .git
it changed
{ action: 'change',
  filename: '.git',
  file: 'C:\\Users\\ewan\\Documents\\git\\appcd-plugin-windows\\.git' }
ignore
2018-01-17T14:35:32.491Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
2018-01-17T14:35:32.542Z appcd:fswatcher FS Event: [change] C:\Users\ewan\Documents\git\appc-daemon → .git
A plugin developer should be able to maintain a list of files/folders to be ignored (and we should have a default set of files/folder to ignore), before reloading the plugin we should inspect this and determine whether we should reload or not. I guess this would be achieved by an ignore field we maybe add to the appcd section of the package.json, or it could be the inverse and a user would only declare exactly what they want to trigger a reload
{
  appcd: {
    ignore: [ '.git/', 'cache/', 'src/' ]
  }
}

Comments

  1. Ewan Harris 2018-01-30

    [~cbarber] Unit tests for this one are a bit of a PITA on Windows due to how the filesystem events work, for example writing a file in a directory causes two events, the add event comes first but the actual event that makes it to the debounced [onFileSystemChange](https://github.com/appcelerator/appc-daemon/blob/2372162d170abdc5bb1bc95d19150557bfd1c65f/packages/appcd-plugin/src/external-plugin.js#L371-L382) function is actually the change event of the directory, should we be normalizing events in appcd-fswatcher to try and handle these platform differences? Update: I guess this is partly down to me mis-understanding debounce, from what I understand now it makes sense for the function to be called with the change event, which seems to make me think we do need to normalize these events in fswatcher
       { action: 'add',
         filename: 'ignoredFile.txt',
         file: 'C:\\Users\\ewan\\AppData\\Local\\Temp\\appcd-plugin-test-13708KYVeCDndfVZS\\0dlxs2\\ignoredFile.txt' }
       { action: 'change',
         filename: '0dlxs2',
         file: 'C:\\Users\\ewan\\AppData\\Local\\Temp\\appcd-plugin-test-13708KYVeCDndfVZS\\0dlxs2' }
       2018-01-30T13:30:03.055Z appcd:plugin:path File system change, re-detecting scheme
       2018-01-30T13:30:03.058Z appcd:plugin:path Detected no scheme change (PluginScheme)
       { action: 'change',
         filename: '0dlxs2',
         file: 'C:\\Users\\ewan\\AppData\\Local\\Temp\\appcd-plugin-test-13708KYVeCDndfVZS\\0dlxs2' }
       

JSON Source