Skip to content

Commit 3e58f77

Browse files
committed
fix fetching chunks after they have been added to cache
1 parent a114633 commit 3e58f77

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

lib/rlib/rcache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ auto RCache::add_internal(RChunk const& chunk, std::span<char const> data) -> vo
167167
this->flush_internal();
168168
}
169169
writer_.chunks.push_back(chunk);
170-
rlib_assert(writer_.buffer.append(data));
171170
lookup_[chunk.chunkId] = {chunk, (BundleID)(files_.size() - 1), writer_.buffer.size() + writer_.toc_offset};
171+
rlib_assert(writer_.buffer.append(data));
172172
auto const buffer_size = writer_.buffer.size();
173173
auto const current_toc_size = files_.back()->size() - writer_.toc_offset;
174174
if (buffer_size > current_toc_size && buffer_size - current_toc_size > options_.flush_size) {

lib/rlib/rcdn.cpp

+2-15
Original file line numberDiff line numberDiff line change
@@ -274,21 +274,8 @@ auto RCDN::get(std::vector<RChunk::Dst> chunks, RChunk::Dst::data_cb on_data) ->
274274
auto RCDN::get_into(RChunk::Src const& src, std::span<char> dst) -> bool {
275275
// FIXME: we are only allowed one RCDN per whole program
276276
thread_local std::unique_ptr<Worker> one_ = {};
277-
try {
278-
if (cache_ && cache_->get_into(src, dst)) {
279-
return true;
280-
}
281-
} catch (std::exception const& error) {
282-
if (!options_.url.empty()) {
283-
if (!one_) {
284-
one_ = std::make_unique<Worker>(this);
285-
}
286-
// If we can fetch the chunk again, ignore exceptions
287-
if (one_->get_into(src, dst)) {
288-
return true;
289-
}
290-
}
291-
throw;
277+
if (cache_ && cache_->get_into(src, dst)) {
278+
return true;
292279
}
293280
if (options_.url.empty()) {
294281
return false;

src/rman_mount.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ struct Main {
161161
"auto_unmount",
162162
"-o",
163163
"noforget",
164+
#ifdef _WIN32
165+
"-o",
166+
"ThreadCount=16",
167+
#endif
164168
cli.output.c_str());
165169
}
166170

0 commit comments

Comments
 (0)