Skip to content

Commit a06f5d4

Browse files
committed
Measure cache commit time in the worker as well
1 parent a134cb9 commit a06f5d4

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

mypy/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,7 @@ def build_inner(
511511
warn_unused_configs(options, flush_errors)
512512
return BuildResult(manager, graph)
513513
finally:
514-
t0 = time.time()
515-
manager.metastore.commit()
516-
manager.add_stats(cache_commit_time=time.time() - t0)
514+
manager.commit()
517515
manager.log(
518516
"Build finished in %.3f seconds with %d modules, and %d errors"
519517
% (
@@ -1134,6 +1132,11 @@ def report_file(
11341132
if self.reports is not None and self.source_set.is_source(file):
11351133
self.reports.file(file, self.modules, type_map, options)
11361134

1135+
def commit(self) -> None:
1136+
t0 = time.time()
1137+
self.metastore.commit()
1138+
self.add_stats(cache_commit_time=time.time() - t0)
1139+
11371140
def verbosity(self) -> int:
11381141
return self.options.verbosity
11391142

mypy/build_worker/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def serve(server: IPCServer, ctx: ServerContext) -> None:
197197
gc.enable()
198198
result = process_stale_scc(graph, scc, manager, from_cache=graph_data.from_cache)
199199
# We must commit after each SCC, otherwise we break --sqlite-cache.
200-
manager.metastore.commit()
200+
manager.commit()
201201
except CompileError as blocker:
202202
send(server, SccResponseMessage(scc_id=scc_id, blocker=blocker))
203203
else:

0 commit comments

Comments
 (0)