Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate notification - a single change triggers 2 notifications to the container. #13

Closed
safizn opened this issue Oct 21, 2018 · 6 comments

Comments

@safizn
Copy link

safizn commented Oct 21, 2018

Hi, all notifications of changes are duplicated, for some reason the container receives double the modification number.
A single file modified change, triggers 2 container notify calls.

docker-volume-watcher *node* -v
INFO:root:Notifier c:\Users/<user>/repository -> app_test_nodejs_run_12:/app created.
INFO:root:Container app_test_nodejs_run_12 has 1 watched directories
INFO:root:Notifying container app_test_nodejs_run_12 about change in /app/x.js
INFO:root:
INFO:root:Notifying container app_test_nodejs_run_12 about change in /app/x.js
INFO:root:

Suggested workaround:

Could you add an option for a slight delay like 100 ms, to prevent docker-volume-watcher from triggering false notifications (when it comes to the same container) ?
e.g. docker-volume-watcher --delay 100

Versions:

pip list

argh                          0.26.2
certifi                       2018.10.15
chardet                       3.0.4
docker                        3.5.1
docker-pycreds                0.3.0
docker-windows-volume-watcher 1.1.0
idna                          2.7
pathtools                     0.1.2
pip                           18.1
pypiwin32                     223
pywin32                       224
PyYAML                        3.13
requests                      2.20.0
setuptools                    39.0.1
six                           1.11.0
urllib3                       1.24
watchdog                      0.9.0
websocket-client              0.53.0
@safizn
Copy link
Author

safizn commented Oct 21, 2018

Maybe can be useful - https://stackoverflow.com/questions/21587415/python-watchdog-modified-and-created-duplicate-events

Sorry I don't deal with python.

@merofeev
Copy link
Owner

Hi Dr. Safi,
Thanks for reporting this. Can you please provide some extra details:

  1. Do you experience this issue during file creation only of during file modification as well?
  2. Does double notification happen with any text editor or with some specific one?

@safizn
Copy link
Author

safizn commented Oct 28, 2018

@merofeev

  1. This happens during file modification. Deleting/Creating files don't cause any notification propagation.
  2. Tested with regular notepad.exe and VSCode both cause the same issue. To make sure no I've closed VSCode and kept only notepad running (preventing any Git modification).

@merofeev
Copy link
Owner

Dear @myuseringithub and @fchastanet,

The version of 1.2.0 docker-windows-volume-watcher has been released. I have added optional debounce support to it.

To try it:

  1. Update docker-windows-volume-watcher: pip install --upgrade docker-windows-volume-watcher
  2. And run it with debounce option: docker-volume-watcher --debounce 0.1

I kindly ask you to test it in your environment and report your results.

If your expireience with this feature is good, I will make it enabled by default in the next release.

@safizn
Copy link
Author

safizn commented Dec 19, 2018

Thanks for the effort, I've implemented my own debounce around the issue. Once I will have time to test it, I will write up.

@safizn safizn closed this as completed Dec 27, 2018
@patricknelson
Copy link

patricknelson commented Oct 30, 2019

Unfortunately I'm still getting I'm getting exactly 2 notifications for every single file change, even with a debounce of 3 seconds. Here's a screncap, you can tell I didn't do anything in between saves (first time was ctrl+s, the second was clicking the save icon, nothing else):

ezgif-4-c16cf52c42fa

Can anyone else reproduce this bug? Here's what I did: In a folder called test I setup docker-compose.yml with the following yaml:

version: '3'
services:
  alpine:
    image: node:6.17-alpine
    entrypoint: tail -f /dev/null
    restart: always
    volumes:
      - .:/var/www/html

Run via docker-compose up -d. Then login to the container via docker exec -it test_alpine_1 sh and install nodemon and start monitoring for changes to text files:

npm install -g nodemon
nodemon -e "*.txt" /tail -f /dev/null

Then be sure you also start docker-volume-watcher. In my case with a --debounce of 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants