mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-06-14 08:29:31 +08:00
fix: update spec status
This commit is contained in:
@@ -253,6 +253,12 @@ impl Service {
|
||||
ObserverEvent::PredicateEnabled(spec) => {
|
||||
if let Some(ref mut predicates_db_conn) = predicates_db_conn {
|
||||
update_predicate_spec(&spec.key(), &spec, predicates_db_conn, &self.ctx);
|
||||
update_predicate_status(
|
||||
&spec.key(),
|
||||
PredicateStatus::InitialScanCompleted,
|
||||
predicates_db_conn,
|
||||
&self.ctx,
|
||||
);
|
||||
}
|
||||
}
|
||||
ObserverEvent::PredicateDeregistered(chainhook) => {
|
||||
@@ -311,6 +317,7 @@ impl Service {
|
||||
};
|
||||
|
||||
for (predicate_uuid, blocks_ids) in report.predicates_evaluated.iter() {}
|
||||
|
||||
for (predicate_uuid, blocks_ids) in report.predicates_triggered.iter() {}
|
||||
// Every 32 blocks, we will check if there's a new Stacks file archive to ingest
|
||||
if stacks_event > 32 {
|
||||
@@ -338,6 +345,7 @@ impl Service {
|
||||
pub enum PredicateStatus {
|
||||
Scanning(ScanningData),
|
||||
Streaming(StreamingData),
|
||||
InitialScanCompleted,
|
||||
Interrupted(String),
|
||||
Disabled,
|
||||
}
|
||||
|
||||
@@ -64,12 +64,13 @@ impl ChainhookConfig {
|
||||
Ok(spec)
|
||||
}
|
||||
|
||||
pub fn enable_specification(&mut self, predicate_spec: &ChainhookSpecification) {
|
||||
pub fn enable_specification(&mut self, predicate_spec: &mut ChainhookSpecification) {
|
||||
match predicate_spec {
|
||||
ChainhookSpecification::Stacks(spec_to_enable) => {
|
||||
for spec in self.stacks_chainhooks.iter_mut() {
|
||||
if spec.uuid.eq(&spec_to_enable.uuid) {
|
||||
spec.enabled = true;
|
||||
spec_to_enable.enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -78,6 +79,7 @@ impl ChainhookConfig {
|
||||
for spec in self.bitcoin_chainhooks.iter_mut() {
|
||||
if spec.uuid.eq(&spec_to_enable.uuid) {
|
||||
spec.enabled = true;
|
||||
spec_to_enable.enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user