Skip to content

Commit

Permalink
Tweak flushing logic to better match #4664
Browse files Browse the repository at this point in the history
They'll still merge conflict, but the resolution will be trivial now
(I'm trying avoid making one depend on the other)
  • Loading branch information
msullivan committed Mar 2, 2018
1 parent 893e1da commit 0f5a411
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ def check_fine_grained(self, sources: List[mypy.build.BuildSource]) -> Dict[str,
def initialize_fine_grained(self, sources: List[mypy.build.BuildSource]) -> Dict[str, Any]:
# The file system cache we create gets passed off to
# BuildManager, and thence to FineGrainedBuildManager, which
# assumes responsibility for clearing it at the appropriate
# times (after init and update()).
# assumes responsibility for clearing it after updates.
fscache = FileSystemCache(self.options.python_version)
self.fswatcher = FileSystemWatcher(fscache)
self.update_sources(sources)
Expand Down Expand Up @@ -295,6 +294,7 @@ def initialize_fine_grained(self, sources: List[mypy.build.BuildSource]) -> Dict
# Run an update
messages = self.fine_grained_manager.update(self.find_changed(sources))

fscache.flush()
status = 1 if messages else 0
return {'out': ''.join(s + '\n' for s in messages), 'err': '', 'status': status}

Expand Down
1 change: 0 additions & 1 deletion mypy/server/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def __init__(self, result: BuildResult) -> None:
manager.saved_cache = {}
# Active triggers during the last update
self.triggered = [] # type: List[str]
self.manager.fscache.flush()

def update(self, changed_modules: List[Tuple[str, str]]) -> List[str]:
"""Update previous build result by processing changed modules.
Expand Down
1 change: 1 addition & 0 deletions mypy/test/testfinegrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:

fine_grained_manager = None
if not self.use_cache:
result.manager.fscache.flush()
fine_grained_manager = FineGrainedBuildManager(result)
if CHECK_CONSISTENCY:
check_consistency(fine_grained_manager)
Expand Down
1 change: 1 addition & 0 deletions mypy/test/testmerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
main_src = '\n'.join(testcase.input)
result = self.build(main_src)
assert result is not None, 'cases where CompileError occurred should not be run'
result.manager.fscache.flush()
fine_grained_manager = FineGrainedBuildManager(result)

a = []
Expand Down

0 comments on commit 0f5a411

Please sign in to comment.