-
Notifications
You must be signed in to change notification settings - Fork 70
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
Closes #786 - Added endpoint which fires a file changed event when triggered. #791
Closes #786 - Added endpoint which fires a file changed event when triggered. #791
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @mbrill-nt)
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 12 at r1 (raw file):
@RestController public class ConfigurationController extends AbstractBaseController {
Small docs please
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):
"servers working directory.") @GetMapping(value = "configuration/reload", produces = "text/plain") public void reloadConfiguration() {
Imo it would be better to secure this endpoint as well.
Maybe it is best if we use the Write
permission, because this event would occure as a result of a file modification.
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):
"servers working directory.") @GetMapping(value = "configuration/reload", produces = "text/plain") public void reloadConfiguration() {
Can you add a small unit test that a event is fire if this method is called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @mariusoe)
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 12 at r1 (raw file):
Previously, mariusoe (Marius Oehler) wrote…
Small docs please
Done.
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):
Previously, mariusoe (Marius Oehler) wrote…
Imo it would be better to secure this endpoint as well.
Maybe it is best if we use theWrite
permission, because this event would occure as a result of a file modification.
Done.
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):
Previously, mariusoe (Marius Oehler) wrote…
Can you add a small unit test that a event is fire if this method is called?
Done.
487b4a5
to
738d7c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 9 files at r3, 3 of 3 files at r4.
Reviewable status: 7 of 9 files reviewed, 3 unresolved discussions (waiting on @JonasKunz, @mariusoe, and @mbrill-nt)
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/file/versioning/ExternalChangeDetector.java, line 27 at r4 (raw file):
public class ExternalChangeDetector { private String latestWorkspaceId;
can you add a short doc to the latestWorkspaceId
and latestLiveId
field
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/file/versioning/ExternalChangeDetector.java, line 52 at r4 (raw file):
latestWorkspaceId = fileManager.getWorkspaceRevision().getRevisionId(); latestLiveId = fileManager.getLiveRevision().getRevisionId(); updateTask = executor.scheduleAtFixedRate(this::checkForUpdates, 1, 1, TimeUnit.SECONDS);
1 second feels quite heavy. How about increasing this to maybe 5 seconds?
components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/file/versioning/ExternalChangeDetector.java, line 52 at r4 (raw file):
latestWorkspaceId = fileManager.getWorkspaceRevision().getRevisionId(); latestLiveId = fileManager.getLiveRevision().getRevisionId(); updateTask = executor.scheduleAtFixedRate(this::checkForUpdates, 1, 1, TimeUnit.SECONDS);
You could remove this line and the executer and all the future logic and just annotate the checkForUpdates
method with the following @Scheduled(fixedRate = 1000)
Then Spring will handle this for you and you can also remove the synchroized because it will not execute them in parallel, unless you also would add @Async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 9 files at r3, 3 of 3 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @JonasKunz)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @JonasKunz)
With the endpoint "configuration/reload" file reloads can you be triggered manually.
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is
This change is