-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[CLN] Remove forked code path for pull logs. #5460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove Forked Code Path for Pulling Logs and Simplify FetchLog Logic This pull request refactors the Key Changes• Removed the legacy fallback code path in Affected Areas• This summary was automatically generated by @propel-code-bot |
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
let start = start as i64; | ||
let sema = Arc::clone(&sema); | ||
async move { | ||
let _permit = sema.acquire().await.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BestPractice]
Potential panic from semaphore acquisition: sema.acquire().await.unwrap()
will panic if the semaphore is closed, which can happen during async task cancellation or if the semaphore is dropped while permits are being acquired. Replace with proper error handling:
let _permit = sema.acquire().await.map_err(|_| {
// Convert semaphore error to appropriate error type
FetchLogError::PullLog(Box::new(/* appropriate error */))
})?;
Or if you want to fail fast on semaphore issues, at least log before panicking.
Context for Agents
[**BestPractice**]
Potential panic from semaphore acquisition: `sema.acquire().await.unwrap()` will panic if the semaphore is closed, which can happen during async task cancellation or if the semaphore is dropped while permits are being acquired. Replace with proper error handling:
```rust
let _permit = sema.acquire().await.map_err(|_| {
// Convert semaphore error to appropriate error type
FetchLogError::PullLog(Box::new(/* appropriate error */))
})?;
```
Or if you want to fail fast on semaphore issues, at least log before panicking.
File: rust/worker/src/execution/operators/fetch_log.rs
Line: 108
Once upon a time we didn't have scout logs. So this could fail and silently fell back on the old behavior. Don't do that anymore.
2ac5524
to
400c68a
Compare
@@ -77,100 +77,61 @@ impl Operator<FetchLogInput, FetchLogOutput> for FetchLogOperator { | |||
); | |||
|
|||
let mut log_client = self.log_client.clone(); | |||
let limit_offset = log_client | |||
let mut limit_offset = log_client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BestPractice]
The variable name limit_offset
could be more descriptive. Based on the knowledge base guideline about variable naming, consider renaming it to specify what type of identifier this represents (e.g., limit_log_offset
or max_log_offset
) to improve readability and maintainability.
Context for Agents
[**BestPractice**]
The variable name `limit_offset` could be more descriptive. Based on the knowledge base guideline about variable naming, consider renaming it to specify what type of identifier this represents (e.g., `limit_log_offset` or `max_log_offset`) to improve readability and maintainability.
File: rust/worker/src/execution/operators/fetch_log.rs
Line: 80
.ok(); | ||
.inspect_err(|err| { | ||
tracing::error!("could not pull logs: {err:?}"); | ||
})?; | ||
let mut fetched = Vec::new(); | ||
let timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_nanos() as i64; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes starting at this point are all whitespace.
Description of changes
Once upon a time we didn't have scout logs. So this could fail and
silently fell back on the old behavior. Don't do that anymore.
Test plan
CI
Migration plan
N/A
Observability plan
N/A
Documentation Changes
N/A