From f1d36b5fe9c16d671e4220fbe1f135256be456ba Mon Sep 17 00:00:00 2001
From: bgallois <benjamin@gallois.cc>
Date: Thu, 12 Dec 2024 17:41:57 +0100
Subject: [PATCH] update oracle service

---
 docs/user/installation_debian.md         |  4 ++--
 resources/debian/distance-oracle.service |  2 +-
 resources/debian/distance-oracle.timer   | 10 ----------
 resources/debian/env_file                |  5 +++++
 4 files changed, 8 insertions(+), 13 deletions(-)
 delete mode 100644 resources/debian/distance-oracle.timer

diff --git a/docs/user/installation_debian.md b/docs/user/installation_debian.md
index 63bc8b37a..00e34d140 100644
--- a/docs/user/installation_debian.md
+++ b/docs/user/installation_debian.md
@@ -22,5 +22,5 @@
 A Smith node needs to be installed.
 
 1. Change the default configuration by modifying `/etc/duniter/env_file`.
-2. Start the service: `sudo systemctl start distance-oracle.timer`.
-3. Enable the service at startup: `sudo systemctl enable distance-oracle.timer`.
+2. Start the service: `sudo systemctl start distance-oracle.service`.
+3. Enable the service at startup: `sudo systemctl enable distance-oracle.service`.
diff --git a/resources/debian/distance-oracle.service b/resources/debian/distance-oracle.service
index 66fe13e53..8bd2fb763 100644
--- a/resources/debian/distance-oracle.service
+++ b/resources/debian/distance-oracle.service
@@ -5,6 +5,6 @@ After=duniter-smith.service
 
 [Service]
 EnvironmentFile=/etc/duniter/env_file
-ExecStart=/usr/bin/duniter2 distance-oracle --evaluation-result-dir ${BASE_PATH}/chains/${DUNITER_CHAIN_NAME}/distance --rpc-url ${ORACLE_RPC_URL} --log ${ORACLE_LOG_LEVEL}
+ExecStart=/usr/bin/duniter2 distance-oracle --evaluation-result-dir ${BASE_PATH}/chains/${DUNITER_CHAIN_NAME}/distance --rpc-url ${ORACLE_RPC_URL} --interval ${ORACLE_INTERVAL} --log ${ORACLE_LOG_LEVEL}
 User=duniter
 Group=duniter
diff --git a/resources/debian/distance-oracle.timer b/resources/debian/distance-oracle.timer
deleted file mode 100644
index de7009329..000000000
--- a/resources/debian/distance-oracle.timer
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Duniter distance oracle timer.
-
-[Timer]
-EnvironmentFile=/etc/duniter/env_file
-OnBootSec=1min
-OnUnitActiveSec=2min
-
-[Install]
-WantedBy=multi-user.target
diff --git a/resources/debian/env_file b/resources/debian/env_file
index e896759f7..61ebfbd28 100644
--- a/resources/debian/env_file
+++ b/resources/debian/env_file
@@ -36,6 +36,11 @@ BASE_PATH=/home/duniter/.local/share/duniter
 # Default: ws://127.0.0.1:9944 for a local WebSocket RPC server.
 ORACLE_RPC_URL=ws://127.0.0.1:9944
 
+# Interval in seconds at which the oracle is run.
+# This should not exceed the evaluation period of the blockchain.
+# Default: 600 seconds
+ORACLE_INTERVAL=600
+
 # Determines the log level for the Oracle.
 # Options include 'error', 'warn', 'info', 'debug', 'trace'.
 # 'info' is a good default that provides useful runtime information without too much detail.
-- 
GitLab