Skip to content

Commit 9f54e9e

Browse files
author
Devdutt Shenoi
committed
coderabbit suggestions
1 parent 92fba76 commit 9f54e9e

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

src/handlers/http/logstream.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,19 @@ pub async fn get_stats(
229229
) -> Result<HttpResponse, StreamError> {
230230
let stream_name = stream_name.into_inner();
231231

232-
if !PARSEABLE.streams.contains(&stream_name) {
233-
// For query mode, if the stream not found in memory map,
234-
//check if it exists in the storage
235-
//create stream and schema from storage
236-
if PARSEABLE.options.mode != Mode::Query
232+
// For query mode, if the stream not found in memory map,
233+
//check if it exists in the storage
234+
//create stream and schema from storage
235+
if !PARSEABLE.streams.contains(&stream_name)
236+
&& (PARSEABLE.options.mode != Mode::Query
237237
|| matches!(
238238
PARSEABLE
239239
.create_stream_and_schema_from_storage(&stream_name)
240240
.await,
241241
Ok(false) | Err(_)
242-
)
243-
{
244-
return Err(StreamNotFound(stream_name).into());
245-
}
242+
))
243+
{
244+
return Err(StreamNotFound(stream_name).into());
246245
}
247246

248247
if let Some(stats) = params.get_stats(&stream_name) {
@@ -325,17 +324,16 @@ pub async fn get_stats(
325324

326325
pub async fn get_stream_info(stream_name: Path<String>) -> Result<impl Responder, StreamError> {
327326
let stream_name = stream_name.into_inner();
328-
if !PARSEABLE.streams.contains(&stream_name) {
329-
if PARSEABLE.options.mode != Mode::Query
327+
if !PARSEABLE.streams.contains(&stream_name)
328+
&& (PARSEABLE.options.mode != Mode::Query
330329
|| matches!(
331330
PARSEABLE
332331
.create_stream_and_schema_from_storage(&stream_name)
333332
.await,
334333
Ok(false) | Err(_)
335-
)
336-
{
337-
return Err(StreamNotFound(stream_name).into());
338-
}
334+
))
335+
{
336+
return Err(StreamNotFound(stream_name).into());
339337
}
340338
let storage = PARSEABLE.storage.get_object_store();
341339
// if first_event_at is not found in memory map, check if it exists in the storage
@@ -436,20 +434,19 @@ pub async fn put_stream_hot_tier(
436434
pub async fn get_stream_hot_tier(stream_name: Path<String>) -> Result<impl Responder, StreamError> {
437435
let stream_name = stream_name.into_inner();
438436

439-
if !PARSEABLE.streams.contains(&stream_name) {
440-
// For query mode, if the stream not found in memory map,
441-
//check if it exists in the storage
442-
//create stream and schema from storage
443-
if PARSEABLE.options.mode != Mode::Query
437+
// For query mode, if the stream not found in memory map,
438+
//check if it exists in the storage
439+
//create stream and schema from storage
440+
if !PARSEABLE.streams.contains(&stream_name)
441+
&& (PARSEABLE.options.mode != Mode::Query
444442
|| matches!(
445443
PARSEABLE
446444
.create_stream_and_schema_from_storage(&stream_name)
447445
.await,
448446
Ok(false) | Err(_)
449-
)
450-
{
451-
return Err(StreamNotFound(stream_name).into());
452-
}
447+
))
448+
{
449+
return Err(StreamNotFound(stream_name).into());
453450
}
454451

455452
let Some(hot_tier_manager) = HotTierManager::global() else {

0 commit comments

Comments
 (0)