This is a browser cache issue.
There is some discussion of it here: this SO post. Essentially the issue here is that you're requesting the same URL over and over again so the default behavior is to cache the response.
Recommendation
Use Flask's send_from_directory() function instead of the static file fetch... e.g.:
from Flask import send_from_directory
@app.route('/get_file/')
def get_file():
# cache_timeout is in seconds from the send_file options
return send_from_directory("data", "xyz.json", cache_timeout=5)
This will set the response headers to indicate to the browser that cache should expire in 5 seconds.
Another way to short circuit the browser cache for this resource (assuming you always want a new response) is to append a timestamp to the end of the URL:
// note... this timestamp approach fails on <IE9
var timestamp = Date.now(),
base_url = "{{ url_for("get_file") }}",
add_timestamp = base_url + "?t=" + timestamp;
d3.json(add_timestamp, function(graph) {
force
.nodes(graph.nodes)
.links(graph.links)
.start();
}
In your serverside script you can just ignore the timestamp argument, but it should reliably short circuit the browser side of any cache issues.