-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.php
47 lines (39 loc) · 1011 Bytes
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once dirname(__FILE__)."/vendor/autoload.php";
try {
$Parser = new \PCSG\SteemBlockchainParser\Parser();
$Config = PCSG\SteemBlockchainParser\Config::getInstance();
} catch (\Exception $Exception) {
echo $Exception->getMessage();
echo PHP_EOL;
exit;
}
// db test
try {
$Parser->getDatabase();
} catch (\Exception $Exception) {
echo $Exception->getMessage();
echo PHP_EOL;
exit;
}
$lastBlock = $Parser->getLatestBlockFromDatabase();
if ($lastBlock === 0) {
try {
$lastBlock = $Config->get('block', 'start');
} catch (\Exception $Exception) {
}
}
try {
$Parser->parseBlockRangeAsync(
$lastBlock + 1,
false,
\PCSG\SteemBlockchainParser\Config::getInstance()->get("requests", "concurrent_requests")
);
} catch (\Exception $Exception) {
echo $Exception->getMessage();
echo PHP_EOL;
exit;
}
// this delay is for the supervisor
// if the process breaks to fast, the supervisor kills it
sleep(1);