From 7e0c2352757c0beea4ac4446b34548b7c1f98a6e Mon Sep 17 00:00:00 2001 From: realaravinth Date: Fri, 3 Jun 2022 23:14:57 +0530 Subject: [PATCH] feat: archive forge data if it doesn't exist --- src/spider.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/spider.rs b/src/spider.rs index 7c5e6ab..f5cfdc4 100644 --- a/src/spider.rs +++ b/src/spider.rs @@ -41,7 +41,15 @@ impl Ctx { forge_type: gitea.forge_type(), }; db.create_forge_isntance(&msg).await.unwrap(); - federate.create_forge_isntance(&msg).await.unwrap(); + } else { + if !federate.forge_exists(hostname).await.unwrap() { + let forge = db.get_forge(hostname).await.unwrap(); + let msg = CreateForge { + hostname, + forge_type: forge.forge_type, + }; + federate.create_forge_isntance(&msg).await.unwrap(); + } } loop {