Skip to content

Commit

Permalink
Partial revert of accountsdb plugin refactor. (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-kast authored Feb 22, 2022
1 parent 2c219f1 commit a18952e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/accountsdb-rabbitmq/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ struct TokenList {
impl AccountsDbPluginRabbitMq {
const TOKEN_REG_URL: &'static str = "https://raw.githubusercontent.com/solana-labs/token-list/main/src/tokens/solana.tokenlist.json";

async fn load_token_reg() -> Result<HashSet<Pubkey>> {
let res: TokenList = reqwest::get(Self::TOKEN_REG_URL)
.await
fn load_token_reg() -> Result<HashSet<Pubkey>> {
// We use `smol` as an executor, and reqwest's async backend doesn't like that
let res: TokenList = reqwest::blocking::get(Self::TOKEN_REG_URL)
.map_err(custom_err)?
.json()
.await
.map_err(custom_err)?;

res.tokens
Expand Down Expand Up @@ -91,6 +90,8 @@ impl AccountsDbPlugin for AccountsDbPluginRabbitMq {
self.acct_sel = Some(acct);
self.ins_sel = Some(ins);

self.token_addresses = Self::load_token_reg()?;

smol::block_on(async {
let conn =
Connection::connect(&amqp.address, ConnectionProperties::default().with_smol())
Expand All @@ -105,8 +106,6 @@ impl AccountsDbPlugin for AccountsDbPluginRabbitMq {
jobs.limit,
));

self.token_addresses = Self::load_token_reg().await?;

Ok(())
})
}
Expand Down

0 comments on commit a18952e

Please sign in to comment.