Skip to content

Commit

Permalink
[apps] Release twitter_binding v6 and deploy to mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar committed Dec 5, 2024
1 parent b77ddf0 commit 24e354a
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 3 deletions.
Binary file added apps/twitter_binding/released/6/package.rpd
Binary file not shown.
15 changes: 15 additions & 0 deletions apps/twitter_binding/sources/tweet_fetcher.move
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,24 @@ module twitter_binding::tweet_fetcher {
};
let buffer_queue_obj = object::new_named_object(buffer_queue);
object::transfer_extend(buffer_queue_obj, @twitter_binding);
}else{
//clear request queue
//because new version use batch API to fetch tweets, the response will be different
//so we need to clear the request queue
clear_old_request_queue();
};
}

fun clear_old_request_queue(){
let fetch_queue_obj = borrow_mut_fetch_queue_obj();
let request_ids = object::borrow(fetch_queue_obj).request_queue;
vector::for_each(request_ids, |request_id|{
//The old version use request id => tweet id
let tweet_id: String = object::remove_field(fetch_queue_obj, request_id);
let _request_id: ObjectID = object::remove_field(fetch_queue_obj, tweet_id);
});
}

public entry fun fetch_tweet_entry(id: String){
let _status = fetch_tweet_v2(id);
}
Expand Down
11 changes: 11 additions & 0 deletions kube/mainnet/schedule/mainnet-tweet-fetch-schedule-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mainnet-tweet-fetch-schedule-data
namespace: mainnet
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
64 changes: 64 additions & 0 deletions kube/mainnet/schedule/mainnet-tweet-fetch-schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mainnet-tweet-fetch-schedule
namespace: mainnet
spec:
replicas: 1
selector:
matchLabels:
app: mainnet-tweet-fetch-schedule
template:
metadata:
labels:
app: mainnet-tweet-fetch-schedule
spec:
initContainers:
- name: init-rooch
image: ghcr.io/rooch-network/rooch:v0.8.0
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /root/.rooch/initialized ]; then
/rooch/rooch init -m "${INIT_SECRET}" --skip-password
/rooch/rooch env switch --alias main
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
/rooch/rooch account create
ls -la /root/.rooch/rooch_config/
touch /root/.rooch/initialized
fi
env:
- name: INIT_SECRET
valueFrom:
secretKeyRef:
name: rooch-mainnet-secrets
key: init-phrase
volumeMounts:
- name: rooch-data
mountPath: /root
containers:
- name: rooch-schedule
image: ghcr.io/rooch-network/rooch:v0.8.0
command: ["/rooch/rooch"]
args:
- "task"
- "schedule"
- "--sender"
# the sixth account
- "rooch1unltrnl5j8s5avmlmn0vuxk3r9y243vd5560uw54kjplg0ecuyxq96yjjq"
- "--checker-function"
- "0x701c21bf1c8cd5af8c42983890d8ca55e7a820171b8e744c13f2d9998bf76cc3::tweet_fetcher::has_buffered_tweets"
- "--runner-function"
- "0x701c21bf1c8cd5af8c42983890d8ca55e7a820171b8e744c13f2d9998bf76cc3::tweet_fetcher::process_buffer_queue"
- "--checker-interval"
- "60"
volumeMounts:
- name: rooch-data
mountPath: /root
volumes:
- name: rooch-data
persistentVolumeClaim:
claimName: mainnet-tweet-fetch-schedule-data
6 changes: 3 additions & 3 deletions kube/testnet/schedule/testnet-tweet-fetch-schedule.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: testnet-gas-market-schedule
name: testnet-tweet-fetch-schedule
namespace: testnet
spec:
replicas: 1
selector:
matchLabels:
app: testnet-gas-market-schedule
app: testnet-tweet-fetch-schedule
template:
metadata:
labels:
app: testnet-gas-market-schedule
app: testnet-tweet-fetch-schedule
spec:
initContainers:
- name: init-rooch
Expand Down

0 comments on commit 24e354a

Please sign in to comment.