-
Notifications
You must be signed in to change notification settings - Fork 275
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
Hot-reload ignores supergraph changes after first reload #2245
Comments
I can confirm that there is something strange happening in this use-case. Even the first re-load took 90s to react in my test setup. |
I think I got to the bottom of this. We use a crate, notify, to provide file notification services within the router and it provides a variety of file notification mechanisms on different platforms. There are some subtleties around this, not least the behaviour of different native services on different platform, with regard to handling renaming and remove/re-create. In order to simplify things, I think the best solution is to stop using the "recommended" watcher for each platform (which leads to variations in behaviour, also known as bugs) and instead to use the PollWatcher which behaves the same way on each platform/file system. The downside to doing this is that the watcher is a little more intrusive in terms of CPU required and it's also less re-active since we only get notifications as aggregated across a "poll interval". I'm going to set the poll interval to be 3 seconds and work on the basis that is reactive enough for things which shouldn't really change that often (configuration, schema, rhai source files). |
fixes: #2245 To get consistent behaviour across multiple platforms and file systems. The watcher may not be as reactive, but I think it's reactive enough for things which shouldn't change frequently.
To get consistent behaviour across multiple platforms and file systems. fixes: #2245 The watcher may not be as reactive, but I think it's reactive enough for things which shouldn't change frequently. As a bonus, we no longer get events if the content is the same, so less spurious reloads, which is good. That means I had to modify the tests though to use different contents. The rhai file watching appeared to be working fine, but to be safe I converted it to the PollWatcher as well.
Describe the bug
Supergraphs managed via configmap will reload exactly once and then fail to update for subsequent changes, despite the supergraph receiving changes in the file system. Only on full restart does router pick up any new changes.
I haven't tested this with non-configmap supergraphs, so I'm not sure if this is specific to schemas managed with configmaps or more widespread.
To Reproduce
kubectl create configmap <configmap_name> --from-file=./supergraph.graphql --namespace <your_namespace>
kubectl replace -f configmap.yaml
.I used a python tool called when-changed to verify that file system events were being emitted when the configmap updated. Both times
/etc/schema/..data
was updated, but Router only reloaded on the first update. This was the command I used to watch for events:when-changed -r /etc/schema echo "%f"
.Expected behavior
After the first update, router should emit a log line saying
reloading schema
and runreload_server
, thereby loading any new schema changes. As should any further updates.Output
in another shell,
Desktop (please complete the following information):
Additional context
Router version is v1.5.0.
The text was updated successfully, but these errors were encountered: