Skip to content

Commit 367b75f

Browse files
I am reducing the needs_updates limit from 100 to just 50 because fetching details of 100 repos in a single query results in 502 errors.
1 parent ddb653e commit 367b75f

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub const GH_GRAPH_QL_PARTIAL_QUERY: &str =
77
include_str!("../GitHub_GQL_API_Files/fetch-search-query-partial.gql");
88
pub const GH_GRAPH_QL_100_REPOS_FRAGMENT: &str =
99
include_str!("../GitHub_GQL_API_Files/fetch-100-repos.gql");
10+
pub const NEEDS_UPDATE_CHUNK_SIZE: usize = 50;
1011
// These are the amount of characters allowed
1112
// for every feild in the database, I am adding
1213
// this to make sure that I don't exceed the length

src/github/cron_update_helper.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use super::types::Node;
22
use crate::GITHUB_KEY;
3-
use crate::constants::GH_GRAPH_QL_100_REPOS_FRAGMENT;
3+
use crate::constants::{
4+
GH_GRAPH_QL_100_REPOS_FRAGMENT,
5+
NEEDS_UPDATE_CHUNK_SIZE};
46
use libsql::{Connection, params};
57
use std::error::Error;
68
use std::sync::Arc;
@@ -147,7 +149,7 @@ pub async fn run_cron_update_once(pool: Arc<Connection>) -> Result<(), Box<dyn E
147149

148150
match make_update_rows_easy(pool.as_ref()).await {
149151
Ok(rows) => {
150-
for chunk in rows.chunks(100) {
152+
for chunk in rows.chunks(NEEDS_UPDATE_CHUNK_SIZE) {
151153
if let Err(error) = process_chunk(chunk, Arc::clone(&pool), &client).await {
152154
eprintln!("process_chunk failed: {error}");
153155
}

0 commit comments

Comments
 (0)