FileLoader: fix queries cancelling
GitOrigin-RevId: 8350a262e0c51563e987e66e77ba1922bb2f5a4d
This commit is contained in:
parent
e3fa28d457
commit
51ff6105cb
@ -67,11 +67,12 @@ void FileLoader::update_local_file_location(const LocalFileLocation &local) {
|
||||
|
||||
void FileLoader::update_download_offset(int64 offset) {
|
||||
if (parts_manager_.get_streaming_offset() != offset) {
|
||||
uint64 begin_part_id = parts_manager_.set_streaming_offset(offset);
|
||||
uint64 end_part_id = begin_part_id + part_map_.size();
|
||||
//TODO: cancel only some queries
|
||||
auto begin_part_id = parts_manager_.set_streaming_offset(offset);
|
||||
auto end_part_id = begin_part_id + static_cast<int32>(part_map_.size()) * 2;
|
||||
VLOG(files) << "Protect parts " << begin_part_id << " ... " << end_part_id;
|
||||
for (auto &it : part_map_) {
|
||||
if (!(begin_part_id <= it.first && it.first < end_part_id)) {
|
||||
if (!(begin_part_id <= it.second.first.id && it.second.first.id < end_part_id)) {
|
||||
VLOG(files) << "Cancel part " << it.second.first.id;
|
||||
it.second.second.reset(); // cancel_query(it.second.second);
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ Status PartsManager::init_known_prefix(int64 known_prefix, size_t part_size, con
|
||||
int32 PartsManager::set_streaming_offset(int64 offset) {
|
||||
auto finish = [&] {
|
||||
set_streaming_limit(streaming_limit_);
|
||||
update_first_empty_part();
|
||||
return first_streaming_empty_part_;
|
||||
update_first_not_ready_part();
|
||||
return first_streaming_not_ready_part_;
|
||||
};
|
||||
|
||||
if (offset < 0 || need_check_ || (!unknown_size_flag_ && get_size() < offset)) {
|
||||
|
Loading…
Reference in New Issue
Block a user