mirror of
https://github.com/atuinsh/atuin.git
synced 2025-06-19 17:38:52 +02:00
fix: idx cache inconsistency (#2231)
This commit is contained in:
parent
c3723aaf27
commit
5fe8ae05e5
@ -219,15 +219,16 @@ impl Store for SqliteStore {
|
|||||||
idx: RecordIdx,
|
idx: RecordIdx,
|
||||||
limit: u64,
|
limit: u64,
|
||||||
) -> Result<Vec<Record<EncryptedData>>> {
|
) -> Result<Vec<Record<EncryptedData>>> {
|
||||||
let res =
|
let res = sqlx::query(
|
||||||
sqlx::query("select * from store where idx >= ?1 and host = ?2 and tag = ?3 limit ?4")
|
"select * from store where idx >= ?1 and host = ?2 and tag = ?3 order by idx asc limit ?4",
|
||||||
.bind(idx as i64)
|
)
|
||||||
.bind(host.0.as_hyphenated().to_string())
|
.bind(idx as i64)
|
||||||
.bind(tag)
|
.bind(host.0.as_hyphenated().to_string())
|
||||||
.bind(limit as i64)
|
.bind(tag)
|
||||||
.map(Self::query_row)
|
.bind(limit as i64)
|
||||||
.fetch_all(&self.pool)
|
.map(Self::query_row)
|
||||||
.await?;
|
.fetch_all(&self.pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ impl Database for Postgres {
|
|||||||
"insert into store_idx_cache
|
"insert into store_idx_cache
|
||||||
(user_id, host, tag, idx)
|
(user_id, host, tag, idx)
|
||||||
values ($1, $2, $3, $4)
|
values ($1, $2, $3, $4)
|
||||||
on conflict(user_id, host, tag) do update set idx = $4
|
on conflict(user_id, host, tag) do update set idx = greatest(idx, $4)
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.bind(user.id)
|
.bind(user.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user