Skip to content

Commit

Permalink
Processes X posts using numeric content id
Browse files Browse the repository at this point in the history
  • Loading branch information
nubis committed Jun 1, 2024
1 parent ba45c67 commit 7011881
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions api/src/models/campaign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl CampaignHub {
Ok(campaign)
}

pub async fn sync_x_collabs(&self) -> AsamiResult<Vec<Collab>> {
pub async fn sync_x_collabs(&self) -> anyhow::Result<Vec<Collab>> {
use twitter_v2::{api_result::*, authorization::BearerToken, TwitterApi};

let mut reqs = vec![];
Expand All @@ -158,9 +158,7 @@ impl CampaignHub {
let api = TwitterApi::new(auth);

for campaign in self.select().budget_gt(weihex("0")).campaign_kind_eq(CampaignKind::XRepost).all().await? {
let post_id = campaign
.attrs
.briefing_json
let post_id = campaign.content_id()?
.parse::<u64>()
.map_err(|_| Error::Validation("content_id".into(), "was stored in the db not as u64".into()))?;

Expand Down
4 changes: 3 additions & 1 deletion api/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ async fn main() {

// The on chain jobs scheduler has its own internal cooldown and backoff.
// We just make sure to wake it up once a second here so that it decides what to do.
every![1000, |s| {
every![10000, |s| {
run!("On chain job scheduler" { s.on_chain_job().run_scheduler().await });
}];
every![60000, |s| {
run!("Sync on-chain events" { s.synced_event().sync_on_chain_events().await });
}];

Expand Down

0 comments on commit 7011881

Please sign in to comment.