Skip to content

Commit

Permalink
delay 40s propose txs + check for closed connection on sse event subs…
Browse files Browse the repository at this point in the history
…cription during connectivityCheck
  • Loading branch information
noahfigueras committed Nov 30, 2023
1 parent 13edad7 commit a68ae20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/oracle/oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export class Oracle extends Config {
async checkConnectivity(logs: boolean) {
try {
const switched = await this.switchToBackup(logs);
if(switched) {
const isClosed = this.event.readyState == EventSource.CLOSED;
if(switched || isClosed) {
this.event.close();
EpochListener(this);
}
Expand Down
2 changes: 1 addition & 1 deletion src/oracle/rebalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function Rebalancer (oracle: Oracle, data: any) {
export async function proposeEpoch(epochData: any, oracle: Oracle, priority: number): Promise<void> {
try {
// Random priority to avoid failed tx
await setTimeout((priority * 30) * 1000);
await setTimeout((priority * 40) * 1000);

// Submit vote
const contract = oracle.governance;
Expand Down

0 comments on commit a68ae20

Please sign in to comment.