Skip to content

Commit 5b3bbb7

Browse files
committed
remove retry logic from the sqlite database too and remove commented out code
1 parent c322f4d commit 5b3bbb7

File tree

2 files changed

+1
-86
lines changed

2 files changed

+1
-86
lines changed

database/src/pool/postgres.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,36 +1648,6 @@ macro_rules! impl_to_postgresql_via_to_string {
16481648

16491649
impl_to_postgresql_via_to_string!(Target);
16501650

1651-
//impl ToSql for Date {
1652-
// fn to_sql(
1653-
// &self,
1654-
// ty: &tokio_postgres::types::Type,
1655-
// out: &mut bytes::BytesMut,
1656-
// ) -> Result<tokio_postgres::types::IsNull, Box<dyn std::error::Error + Sync + Send>> {
1657-
// self.0.to_sql(ty, out)
1658-
// }
1659-
//
1660-
// fn accepts(ty: &tokio_postgres::types::Type) -> bool {
1661-
// <DateTime<Utc> as tokio_postgres::types::ToSql>::accepts(ty)
1662-
// }
1663-
//
1664-
// tokio_postgres::types::to_sql_checked!();
1665-
//}
1666-
//
1667-
//impl<'a> FromSql<'a> for Date {
1668-
// fn from_sql(
1669-
// ty: &tokio_postgres::types::Type,
1670-
// raw: &'a [u8],
1671-
// ) -> Result<Date, Box<dyn std::error::Error + Sync + Send>> {
1672-
// let dt = DateTime::<Utc>::from_sql(ty, raw)?;
1673-
// Ok(Date(dt))
1674-
// }
1675-
//
1676-
// fn accepts(ty: &tokio_postgres::types::Type) -> bool {
1677-
// <DateTime<Utc> as FromSql>::accepts(ty)
1678-
// }
1679-
//}
1680-
16811651
fn parse_artifact_id(ty: &str, sha: &str, date: Option<DateTime<Utc>>) -> ArtifactId {
16821652
match ty {
16831653
"master" => ArtifactId::Commit(Commit {

database/src/pool/sqlite.rs

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ static MIGRATIONS: &[Migration] = &[
423423
started_at TIMESTAMP,
424424
finished_at TIMESTAMP,
425425
status TEXT,
426-
retries INTEGER DEFAULT 0,
427426
PRIMARY KEY (sha, target)
428427
);
429428
"#,
@@ -1396,58 +1395,6 @@ impl Connection for SqliteConnection {
13961395
)
13971396
}
13981397

1399-
/* Check to see if this machine possibly went offline while doing
1400-
* a previous job - if it did we'll take that job */
1401-
let maybe_previous_job = self
1402-
.raw_ref()
1403-
.prepare(
1404-
"
1405-
WITH job_to_update AS (
1406-
SELECT
1407-
sha,
1408-
parent_sha,
1409-
commit_type,
1410-
pr,
1411-
release_tag,
1412-
commit_time,
1413-
target,
1414-
include,
1415-
exclude,
1416-
runs,
1417-
backends,
1418-
machine_id,
1419-
started_at,
1420-
finished_at,
1421-
status,
1422-
retries
1423-
FROM commit_queue
1424-
WHERE machine_id = ?
1425-
AND target = ?
1426-
AND status = 'in_progress'
1427-
AND retries < 3
1428-
ORDER BY started_at
1429-
LIMIT 1
1430-
)
1431-
UPDATE commit_queue AS cq
1432-
SET started_at = DATETIME('now'),
1433-
status = 'in_progress',
1434-
retries = cq.retries + 1
1435-
WHERE cq.sha = (SELECT sha FROM job_to_update)
1436-
RETURNING *;
1437-
",
1438-
)
1439-
.unwrap()
1440-
.query_map(params![machine_id, &target], |row| {
1441-
Ok(commit_queue_row_to_commit_job(row))
1442-
})
1443-
.unwrap()
1444-
.map(|row| row.unwrap())
1445-
.collect::<Vec<CommitJob>>();
1446-
1447-
if let Some(previous_job) = maybe_previous_job.first() {
1448-
return Some(previous_job.clone());
1449-
}
1450-
14511398
/* Check to see if we are out of sync with other collectors of
14521399
* different architectures, if we are we will update the row and
14531400
* return this `sha` */
@@ -1471,8 +1418,7 @@ impl Connection for SqliteConnection {
14711418
machine_id,
14721419
started_at,
14731420
finished_at,
1474-
status,
1475-
retries
1421+
status
14761422
FROM commit_queue
14771423
WHERE target != ? AND status IN ('finished', 'in_progress')
14781424
ORDER BY started_at
@@ -1522,7 +1468,6 @@ impl Connection for SqliteConnection {
15221468
started_at,
15231469
finished_at,
15241470
status,
1525-
retries,
15261471
CASE
15271472
WHEN commit_type = 'release' THEN 0
15281473
WHEN commit_type = 'master' THEN 1

0 commit comments

Comments
 (0)