Auto-indexing service and GraphQL API for AT Protocol Records quickslice.slices.network/
atproto gleam graphql

chore: remove unused backfill CLI command

The backfill functionality is now accessible via the triggerBackfill
GraphQL mutation in the admin API, making this CLI command redundant.

-110
-110
server/src/server.gleam
··· 1 1 import activity_cleanup 2 - import argv 3 2 import backfill 4 3 import backfill_state 5 4 import database/connection 6 5 import database/repositories/config as config_repo 7 - import database/repositories/lexicons 8 6 import dotenv_gleam 9 7 import envoy 10 8 import gleam/erlang/process 11 9 import gleam/http as gleam_http 12 10 import gleam/http/request 13 11 import gleam/int 14 - import gleam/list 15 12 import gleam/option 16 13 import gleam/string 17 14 import gleam/uri ··· 62 59 } 63 60 64 61 pub fn main() { 65 - // Check for CLI arguments 66 - case argv.load().arguments { 67 - ["backfill"] -> run_backfill_command() 68 - _ -> start_server_normally() 69 - } 70 - } 71 - 72 - fn run_backfill_command() { 73 - logging.log( 74 - logging.Info, 75 - "Starting backfill for record-type lexicon collections", 76 - ) 77 - logging.log(logging.Info, "") 78 - 79 - // Get database URL from environment variable or use default 80 - let database_url = case envoy.get("DATABASE_URL") { 81 - Ok(url) -> url 82 - Error(_) -> "quickslice.db" 83 - } 84 - 85 - // Initialize the database 86 - let assert Ok(db) = connection.initialize(database_url) 87 - 88 - // Get domain authority from database 89 - let domain_authority = case config_repo.get(db, "domain_authority") { 90 - Ok(authority) -> authority 91 - Error(_) -> { 92 - logging.log( 93 - logging.Warning, 94 - "No domain_authority configured. All collections will be treated as external.", 95 - ) 96 - "" 97 - } 98 - } 99 - 100 - // Get all record-type lexicons 101 - logging.log(logging.Info, "Fetching record-type lexicons from database...") 102 - case lexicons.get_record_types(db) { 103 - Ok(lexicons) -> { 104 - case lexicons { 105 - [] -> { 106 - logging.log( 107 - logging.Warning, 108 - "No record-type lexicons found in database", 109 - ) 110 - logging.log( 111 - logging.Info, 112 - " Hint: Run 'gleam run -- import priv/lexicons' to import lexicons first", 113 - ) 114 - } 115 - _ -> { 116 - // Separate lexicons by domain authority 117 - let #(local_lexicons, external_lexicons) = 118 - lexicons 119 - |> list.partition(fn(lex) { 120 - backfill.nsid_matches_domain_authority(lex.id, domain_authority) 121 - }) 122 - 123 - let collections = list.map(local_lexicons, fn(lex) { lex.id }) 124 - let external_collections = 125 - list.map(external_lexicons, fn(lex) { lex.id }) 126 - 127 - logging.log( 128 - logging.Info, 129 - "Found " 130 - <> int.to_string(list.length(collections)) 131 - <> " local collection(s):", 132 - ) 133 - list.each(collections, fn(col) { 134 - logging.log(logging.Info, " - " <> col) 135 - }) 136 - 137 - case external_collections { 138 - [] -> Nil 139 - _ -> { 140 - logging.log(logging.Info, "") 141 - logging.log( 142 - logging.Info, 143 - "Found " 144 - <> int.to_string(list.length(external_collections)) 145 - <> " external collection(s):", 146 - ) 147 - list.each(external_collections, fn(col) { 148 - logging.log(logging.Info, " - " <> col) 149 - }) 150 - } 151 - } 152 - 153 - logging.log(logging.Info, "") 154 - let config = backfill.default_config(db) 155 - backfill.backfill_collections( 156 - [], 157 - collections, 158 - external_collections, 159 - config, 160 - db, 161 - ) 162 - } 163 - } 164 - } 165 - Error(_) -> { 166 - logging.log(logging.Error, "Failed to fetch lexicons from database") 167 - } 168 - } 169 - } 170 - 171 - fn start_server_normally() { 172 62 // Initialize logging 173 63 logging.configure() 174 64 logging.set_level(logging.Info)