zVPS / zvps-netbeans-phpunit-watcher

Listens for the file save command and tries to run the associated phpunit test file.
4 stars 2 forks source link

"Copy Support is still running" issue with #5

Open fanphp opened 8 years ago

fanphp commented 8 years ago

Hi, probabply, this plugin may cause problem with remote syncronization.

This is my experience: I have a project with a remote connection, my "run" option is "upload on save", so every time I save a file, it starts the upload process and, after a random number of "save" process, I get this warning from nb:

"Copy Support is still running - do you want to continue?"

I disabled the plugin, and this error disappeared ...

Thanks!

Caffe1neAdd1ct commented 8 years ago

Thanks for reporting, I have noticed this error on one of my environments.

I'll have a look into this and update as soon as possible. On 21 Jan 2016 10:48, "fanphp" notifications@github.com wrote:

Hi, probabply, this plugin may cause problem with remote syncronization

This is my experience: I have a project with a remote connection, my "run" option is "upload on save", so every time I save a file, it starts the upload process and, after a random number of "save" process, I get this warning from nb:

"Copy Support is still running - do you want to continue?"

I disabled the plugin, and this error disappeared

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/zVPS/zvps-netbeans-phpunit-watcher/issues/5.

fanphp commented 8 years ago

Thanks in advance!!

An enhancement, I think it'd be very useful to let the user to enable/disable this plugin by single project, OR you can check if there is a "test folder" added to project configuration, OR if phpunit is enabled for current project !

Thanks !

Caffe1neAdd1ct commented 8 years ago

Thanks for the additional ideas/feedback.

I'll get the bug fixed first then look at enable/disable. Could be very useful! On 21 Jan 2016 13:20, "fanphp" notifications@github.com wrote:

Thanks in advance!!

An enhancement, I think it'd be very useful to let the user to enable/disable this plugin by single project, OR you can check if there is a "test folder" added to project configuration, OR if phpunit is enabled for current project !

Thanks !

— Reply to this email directly or view it on GitHub https://github.com/zVPS/zvps-netbeans-phpunit-watcher/issues/5#issuecomment-173566258 .

Caffe1neAdd1ct commented 8 years ago

Had a good look into this, with the current RequestProcessor implementation i don't think we can get round the "Copy Support" issue.

I think we will need to go back to implementing a list of file change listeners which then run the task when any registered files change.

Looking at other plugins performing actions on save (https://github.com/vralfy/phpcsmd) they seem to have this implementation.

RequestProcessor EventQueue - i now remember having issues with when first making this plugin..

Hoping to get a bit more time to work on this plugin over the weekend.

Caffe1neAdd1ct commented 8 years ago

Raised a bug report on the netbeans bugzilla for the PHP Project as I can't see a nice way around this message coming up https://netbeans.org/bugzilla/show_bug.cgi?id=258103

I'll let you know when we've fix this one up.

Caffe1neAdd1ct commented 8 years ago

@tmysik Including for info.

I've implemented RP.Task.schedule(1000) and seems to be working ok for me now.

Still an issue when saving the same file in quick succession many times, so this is a partial fix for now.

Going to split @fanphp 's request for enable / disable into a separate issue.

tmysik commented 8 years ago

Your change is not correct. You need just one instance (per project I guess) of RequestProcessor.Task so its schedule() method can do a rescheduling. Right now, you just run your hook always once second after the file save happens (instead of cancelling already scheduled tasks and running just the last one).

Caffe1neAdd1ct commented 8 years ago

@tmysik thanks for reviewing, i'll have another go and update :+1:

Caffe1neAdd1ct commented 8 years ago

@tmysik I have a way around this, but it involves storing the RP task on the factory and having whole code inside the factory which really doesn't seem like a nice way of doing it.

I'll push the code up but if you have time to change / re-implement in a better fashion please do (my Java is very limited and I need to spend some time learning).

tmysik commented 8 years ago

@Caffe1neAdd1ct Sorry, I overlooked that you invoke COMMAND_TEST_SINGLE (I thought that you run all tests for the project, the COMMAND_TEST command). In such a case, there should be a RequestProcessor.Task for each individual file which seems to be an overhead to me. So, simply postpone running your code after file save happens (so, the previous version was fine, sorry!).

What scenario I wanted to support? Please, let's consider that COMMAND_TEST is called so the following steps are correct:

Having a task per project would be necessary to avoid cancelling task for running tests for ProjectA if any file from ProjectB is edited & saved in shorter interval than 1 second after a task for ProjectA was scheduled.

Thanks.

Caffe1neAdd1ct commented 8 years ago

@tmysik What would be better?

  1. new RP.Task for each time a user saves any file (https://github.com/zVPS/zvps-netbeans-phpunit-watcher/blob/ced4f0df99ed3302bb21991cfca6c8492f5aed28/src/org/zvps/phpunitwatcher/PhpOnSaveTask.java)
  2. single instance of RP.Task which is used each time a user saves allowing .schedule to cancel other attempts from running? (https://github.com/zVPS/zvps-netbeans-phpunit-watcher/blob/master/src/org/zvps/phpunitwatcher/PhpOnSaveTask.java)

If you save the same file many times 1. will attempt to run the test equal to the number of times file is saved, 2. will run the test for the file once after file is saved the last time and cancel other test run attempts.

tmysik commented 8 years ago

Number 2. is in fact incorrect, as I tried to explain in my previous comment.

So, I would go with 1. and wait for the negative feedback, if any.

Thanks.

Caffe1neAdd1ct commented 8 years ago

Re-tested 1. and the scheduled task is successfully cancelled if another save is done :+1: Tested with a quick sleep(5); in the PHPUnit test then re-saving while task was running.

If you perform 3 saves in very quick succession then the "copy support" message comes up, however i think this will solve the issue for most users.

I'll get a new release up on the plugins page shortly.

tmysik commented 8 years ago

Re-tested 1. and the scheduled task is successfully cancelled if another save is done

Sounds suspicious to me ;)

But great to hear that it works for you!

Caffe1neAdd1ct commented 8 years ago

1. - take that back, it doesn't cancel the existing running, just starts another unit test in a new output tab, however the results tab reloads and starts showing the latest test process output.

fanphp commented 8 years ago

Hi guys,

I notice that "reformat on saving" does not work any more if plugin is activated; you you know about this issue?

tmysik commented 8 years ago

@fanphp The best you can do is - as always ;) - report it as a new issue [1], provide exact steps to reproduce and attach your IDE log once you reproduce your problem.

Thanks. [1] https://netbeans.org/community/issues.html