Skip to content

Commit 94facc9

Browse files
committed
Hack to disable the fetcher cache in forked processes
1 parent d3ff470 commit 94facc9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/libfetchers/cache.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ struct CacheImpl : Cache
5454
const Key & key,
5555
const Attrs & value) override
5656
{
57+
if (disabled()) return;
58+
5759
_state.lock()->upsert.use()
5860
(key.first)
5961
(attrsToJSON(key.second).dump())
@@ -81,9 +83,20 @@ struct CacheImpl : Cache
8183
return {};
8284
}
8385

86+
pid_t originalPid = getpid();
87+
88+
bool disabled()
89+
{
90+
// FIXME: Temporary hack to disable the cache in
91+
// builtin:fetch-tree builders.
92+
return getpid() != originalPid;
93+
}
94+
8495
std::optional<Result> lookupExpired(
8596
const Key & key) override
8697
{
98+
if (disabled()) return {};
99+
87100
auto state(_state.lock());
88101

89102
auto keyJSON = attrsToJSON(key.second).dump();
@@ -111,6 +124,8 @@ struct CacheImpl : Cache
111124
Attrs value,
112125
const StorePath & storePath) override
113126
{
127+
if (disabled()) return;
128+
114129
/* Add the store prefix to the cache key to handle multiple
115130
store prefixes. */
116131
key.second.insert_or_assign("store", store.storeDir);

0 commit comments

Comments
 (0)