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

More efficient lastLocation handling in watch mode #187

Merged
merged 5 commits into from
Aug 18, 2023

Conversation

jglick
Copy link
Member

@jglick jglick commented Aug 17, 2023

Since the task recurs every 100ms, it seems unnecessary to read a file that we just wrote to disk.

Though `.watch` actually ran decent test coverage of push mode,
JaCoCo did not show `Watcher` since all the tests ran on agents in another JVM.
Adding a mode to run on-controller since people do sometimes do that,
and it should show up in JaCoCo,
and log messages from the watcher go to test output which is helpful.
@jglick jglick marked this pull request as draft August 18, 2023 18:07
@jglick

This comment was marked as resolved.

@jglick jglick marked this pull request as ready for review August 18, 2023 18:36
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- https://github.com/jenkinsci/plugin-pom/pull/560#issuecomment-1656232490 -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FilePath lastLocationFile = controller.getLastLocationFile(workspace);
if (lastLocationFile.exists()) {
lastLocation = Long.parseLong(lastLocationFile.readToString());
LOGGER.finest(() -> "Loaded lastLocation=" + lastLocation);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to actually be missing from test coverage in this plugin currently; workflow-durable-task-step does exercise it in tests relating to agent disconnections and controller restarts.

@jglick jglick merged commit aa22cf1 into jenkinsci:master Aug 18, 2023
13 checks passed
@jglick jglick deleted the lastLocation branch August 18, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants