Skip to content

Commit 89147aa

Browse files
committed
feat(service): send screenscraper hashes in one combined jeuInfos.php request
1 parent 63e3a00 commit 89147aa

3 files changed

Lines changed: 252 additions & 208 deletions

File tree

service/src/providers/screenscraper/cache.rs

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -146,76 +146,3 @@ pub async fn search_ss_games_cached(
146146
)
147147
.await
148148
}
149-
150-
pub async fn get_ss_game_by_md5_cached(
151-
client: &ScreenScraperClient,
152-
redis_conn: &mut MultiplexedConnection,
153-
system_id: i32,
154-
rom_name: String,
155-
rom_size: Option<i64>,
156-
md5: String,
157-
) -> anyhow::Result<Option<SsGame>> {
158-
let lower = md5.to_lowercase();
159-
let cache_key = provider_cache_key(PROVIDER_LABEL, "game:md5", &format!("{system_id}:{lower}"));
160-
cached_get_or_fetch_single(
161-
redis_conn,
162-
cache_key,
163-
SS_CACHE_LIFETIME_GAME,
164-
"Game by MD5",
165-
|| async {
166-
client
167-
.get_game_by_md5(system_id, &rom_name, rom_size, &lower)
168-
.await
169-
},
170-
)
171-
.await
172-
}
173-
174-
pub async fn get_ss_game_by_sha1_cached(
175-
client: &ScreenScraperClient,
176-
redis_conn: &mut MultiplexedConnection,
177-
system_id: i32,
178-
rom_name: String,
179-
rom_size: Option<i64>,
180-
sha1: String,
181-
) -> anyhow::Result<Option<SsGame>> {
182-
let lower = sha1.to_lowercase();
183-
let cache_key =
184-
provider_cache_key(PROVIDER_LABEL, "game:sha1", &format!("{system_id}:{lower}"));
185-
cached_get_or_fetch_single(
186-
redis_conn,
187-
cache_key,
188-
SS_CACHE_LIFETIME_GAME,
189-
"Game by SHA1",
190-
|| async {
191-
client
192-
.get_game_by_sha1(system_id, &rom_name, rom_size, &lower)
193-
.await
194-
},
195-
)
196-
.await
197-
}
198-
199-
pub async fn get_ss_game_by_crc_cached(
200-
client: &ScreenScraperClient,
201-
redis_conn: &mut MultiplexedConnection,
202-
system_id: i32,
203-
rom_name: String,
204-
rom_size: Option<i64>,
205-
crc: String,
206-
) -> anyhow::Result<Option<SsGame>> {
207-
let lower = crc.to_lowercase();
208-
let cache_key = provider_cache_key(PROVIDER_LABEL, "game:crc", &format!("{system_id}:{lower}"));
209-
cached_get_or_fetch_single(
210-
redis_conn,
211-
cache_key,
212-
SS_CACHE_LIFETIME_GAME,
213-
"Game by CRC",
214-
|| async {
215-
client
216-
.get_game_by_crc(system_id, &rom_name, rom_size, &lower)
217-
.await
218-
},
219-
)
220-
.await
221-
}

0 commit comments

Comments
 (0)