File tree 5 files changed +71
-6
lines changed
5 files changed +71
-6
lines changed Original file line number Diff line number Diff line change
1
+ # v0.4.10
2
+ - fix: emit event when arkiver is synced
3
+ - - fix: set maxQueueSize to 3
4
+
1
5
# v0.4.9
2
6
- chore: add environment flag to deploy command
3
7
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
14
14
} from './cli/mod.ts'
15
15
import 'https://deno.land/std@0.179.0/dotenv/load.ts'
16
16
17
- export const version = 'v0.4.9 '
17
+ export const version = 'v0.4.10 '
18
18
19
19
const command = new Command ( )
20
20
. name ( 'arkiver' )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export class Arkiver extends EventTarget {
8
8
private readonly manifest : ArkiveManifest
9
9
private arkiveData : Arkive
10
10
private sources : DataSource [ ] = [ ]
11
+ private syncedCount = 0
11
12
private mongoConnection ?: string
12
13
private rpcUrls : Record < string , string >
13
14
@@ -73,6 +74,17 @@ export class Arkiver extends EventTarget {
73
74
noDb : this . mongoConnection === undefined ,
74
75
arkiveMinorVersion : this . arkiveData . deployment . minor_version ,
75
76
} )
77
+
78
+ dataSource . addEventListener ( 'synced' , ( ) => {
79
+ this . syncedCount ++
80
+ if ( this . syncedCount === Object . entries ( dataSources ) . length ) {
81
+ logger ( 'arkiver' ) . info (
82
+ `Arkiver synced - ${ this . arkiveData . name } ` ,
83
+ )
84
+ this . dispatchEvent ( new Event ( 'synced' ) )
85
+ }
86
+ } )
87
+
76
88
await dataSource . run ( )
77
89
this . sources . push ( dataSource )
78
90
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ interface NormalizedContracts {
40
40
signatureTopics : string [ ]
41
41
}
42
42
43
- export class DataSource {
43
+ export class DataSource extends EventTarget {
44
44
private readonly chain : keyof typeof supportedChains
45
45
private readonly rpcUrl : string
46
46
private readonly client : PublicClient < HttpTransport >
@@ -100,7 +100,7 @@ export class DataSource {
100
100
fetcher : true ,
101
101
processor : true ,
102
102
}
103
- private maxQueueSize = 10
103
+ private maxQueueSize = 3
104
104
private liveDelay = 2000
105
105
private queueDelay = 500
106
106
private fetchInterval = 500
@@ -124,6 +124,7 @@ export class DataSource {
124
124
noDb : boolean
125
125
} ,
126
126
) {
127
+ super ( )
127
128
this . chain = params . chain
128
129
this . rpcUrl = params . rpcUrl
129
130
this . blockRange = params . blockRange
@@ -208,6 +209,7 @@ export class DataSource {
208
209
209
210
if ( toBlock === this . liveBlockHeight && ! this . isLive ) {
210
211
this . isLive = true
212
+ this . dispatchEvent ( new Event ( 'synced' ) )
211
213
logger ( this . chain ) . info (
212
214
`Start live arkiving for ${ this . chain } at ${ this . liveBlockHeight } ` ,
213
215
)
You can’t perform that action at this time.
0 commit comments