From 3aabd8b8715a0edee91af608efb22e0297854bea Mon Sep 17 00:00:00 2001
From: Robert Martin-Legene <robert@martin-legene.dk>
Date: Fri, 17 Jul 2020 12:43:57 -0300
Subject: [PATCH] Initial sleep allowing postgres time to start

---
 collector/collector.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/collector/collector.pl b/collector/collector.pl
index 441b8b9..7796645 100755
--- a/collector/collector.pl
+++ b/collector/collector.pl
@@ -165,7 +165,7 @@ sub     getTransByHash
         'eth_getTransactionByHash',
         $hash
     );
-    die "Invalid object received:\n".Dumper($json) if not exists $json->{'number'};
+    die "Invalid object received when asking for $hash:\n".Dumper($json) if not exists $json->{'blockNumber'};
     my  $max                    =   0;
     my  $rcpt                   =   undef;
     do {
@@ -305,8 +305,10 @@ sub     allsnaps
 sub     main
 {
     $|                      =   1;
-    $sql                    =   sql->new();
     versioncheck();
+    # Give Postgres time to start up.
+    sleep(3);
+    $sql                    =   sql->new();
     info                        "Looking for orphaned blocks in the "
                             .   "database.\n";
     push @blockqueue,           $sql->listOrphans();
-- 
GitLab