Fix api 1 status request

This commit is contained in:
Dominik Werder
2024-10-07 23:40:56 +02:00
parent 8bddb73579
commit 365cdcf2d6
11 changed files with 167 additions and 68 deletions

View File

@@ -43,7 +43,8 @@ pub enum DataParseError {
HeaderTooLarge,
Utf8Error,
EventTooShort,
EventTooLong,
#[error("EventTooLong({0}, {1})")]
EventTooLong(Shape, u32),
TooManyBeforeRange,
EventWithOptional,
BadTypeIndex,
@@ -261,10 +262,17 @@ impl EventChunker {
if len < 20 {
return Err(DataParseError::EventTooShort);
}
match self.fetch_info.shape() {
Shape::Scalar if len > 1000 => return Err(DataParseError::EventTooLong),
Shape::Wave(_) if len > 500000 * 8 => return Err(DataParseError::EventTooLong),
Shape::Image(_, _) if len > 3200 * 3200 * 8 => return Err(DataParseError::EventTooLong),
let shape = self.fetch_info.shape();
match shape {
Shape::Scalar if len > 1024 * 64 => {
return Err(DataParseError::EventTooLong(shape.clone(), len as _))
}
Shape::Wave(_) if len > 1024 * 1024 * 32 => {
return Err(DataParseError::EventTooLong(shape.clone(), len as _))
}
Shape::Image(_, _) if len > 1024 * 1024 * 200 => {
return Err(DataParseError::EventTooLong(shape.clone(), len as _))
}
_ => {}
}
let len = len as u32;
@@ -481,11 +489,12 @@ impl EventChunker {
log_items.push(item);
}
}
Err(_) => {
Err(e) => {
self.discard_count_shape_derived_err += 1;
ret.pop_back();
let msg = format!(
"shape_derived error {:?} {:?}",
"shape_derived error {} {:?} {:?}",
e,
self.fetch_info.scalar_type(),
self.fetch_info.shape(),
);