Repository: TabbyML/tabby
File: ee/tabby-webserver/src/service/background_job/third_party_integration/pulls.rs (Rust)

Code before:
                        break;
                    }
            };

            let pages = response.number_of_pages().unwrap_or_default();

            for pull in response.items {
                // skip closed but not merged pulls
                if let Some(state) = pull.state {
                    if state == IssueState::Closed && pull.merged_at.is_none() {
                        continue
                    }
                }

                let url = pull.html_url.map(|url| url.to_string()).unwrap_or_else(|| pull.url);
                let diff = match octocrab.pulls(&owner, &repo).get_diff(pull.number).await {
                    Ok(x) if x.len() < 1024*1024 => x,
                    Ok(_) => {
                        logkit::warn!("Pull request {} diff is larger than 1MB, skipping", url);
                        continue
                    }
                    Err(e) => {
                        logkit::error!("Failed to fetch pull request patch for {}: {}", url, e);
                        continue
                    }
                };

                let doc = StructuredDoc {
                    source_id: source_id.to_string(),
                    fields: StructuredDocFields::Pull(StructuredDocPullDocumentFields {
                        link: url,
                        title: pull.title.unwrap_or_default(),
                        body: pull.body.unwrap_or_default(),
                        diff,
                        merged: pull.merged_at.is_some(),
                    })
                };

                yield (pull.updated_at.unwrap(), doc);
            }

            page += 1;
            if page > pages {
                break;
            }
        }
    };

    Ok(s)
}


Review comment (bug):
```suggestion
                    Err(e) => {
                        logkit::error!("Failed to fetch pull request diff for {}: {}", url, e);
                        continue
                    }
                };
```

Code after:
                        break;
                    }
            };

            let pages = response.number_of_pages().unwrap_or_default();

            for pull in response.items {
                // skip closed but not merged pulls
                if let Some(state) = pull.state {
                    if state == IssueState::Closed && pull.merged_at.is_none() {
                        continue
                    }
                }

                let url = pull.html_url.map(|url| url.to_string()).unwrap_or_else(|| pull.url);
                let diff = match octocrab.pulls(&owner, &repo).get_diff(pull.number).await {
                    Ok(x) if x.len() < 1024*1024*10 => x,
                    Ok(_) => {
                        logkit::warn!("Pull request {} diff is larger than 10MB, skipping", url);
                        continue
                    }
                    Err(e) => {
                        logkit::error!("Failed to fetch pull request diff for {}: {}", url, e);
                        continue
                    }
                };

                let doc = StructuredDoc {
                    source_id: source_id.to_string(),
                    fields: StructuredDocFields::Pull(StructuredDocPullDocumentFields {
                        link: url,
                        title: pull.title.unwrap_or_default(),
                        body: pull.body.unwrap_or_default(),
                        diff,
                        merged: pull.merged_at.is_some(),
                    })
                };

                yield (pull.updated_at.unwrap(), doc);
            }

            page += 1;
            if page > pages {
                break;
            }
        }
    };

    Ok(s)
}