Closed FroMage closed 5 years ago
That's not the issue. The issue is that we're writing the test file at time 1000 (ms), then the dev mode server catches the current time millis which say 2025 ms, and we do the modification at 2000 ms and the modification isn't picked up.
Proof:
[INFO] Running io.quarkus.undertow.test.devmode.ServletChangeTestCase
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java ispresent: true
wasRecentlyModified /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java sourceMod: 1566401423000 lastChange: 1566401425039
2019-08-21 17:30:25,047 INFO [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-08-21 17:30:25,201 INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 154ms
2019-08-21 17:30:25,265 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 0.063s. Listening on: http://0.0.0.0:8080
2019-08-21 17:30:25,266 INFO [io.quarkus] (main) Installed features: [cdi, vertx, vertx-web]
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java ispresent: true
wasRecentlyModified /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java sourceMod: 1566401423000 lastChange: 1566401425039
Checked for file changes: [] classes changed: false
Modifying file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java
Modifying file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java done
Modifying file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java done sleeping
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode ispresent: false
Watching source file /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java ispresent: true
wasRecentlyModified /home/stephane/src/java-eclipse/quarkus/extensions/undertow/deployment/target/quarkus-dev-mode-test8002444265299259795/src/main/java/io/quarkus/undertow/test/devmode/DevServlet.java sourceMod: 1566401425000 lastChange: 1566401425039
Checked for file changes: [] classes changed: false
So there are two mysteries:
currentTimeMillis()
used by lastChange
start greater than the file modification which occurs later?OK, ferget it, I needed this:
Thread.sleep(2002 - (System.currentTimeMillis() % 1000));
Instead of:
Thread.sleep(2002 - (System.currentTimeMillis() % 2000));
Duh. I'll make a PR.
Fixed otherwise.
It's semi-random, and I can't reproduce it in the IDE where the test always passes, but on the CLI it fails every time now for me, even though I've bumped the sleeps to 3s.
Running them, I do observe some behaviour differences between the CLI:
And the IDE:
For instance, in the IDE, there is a sleep of 3s that is not observed in the CLI (for some reason), and the in the IDE the change is picked up right away on the next request, while on the CLI there appears to be 3 restarts before the change is picked up. No idea why those restarts…