Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bsa_miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nazarf
bsa_miner
Commits
54f05aa2
Commit
54f05aa2
authored
Jun 01, 2023
by
nazarf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add monitoring miner on safex pool
parent
7d9678c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
schedule.rb
config/schedule.rb
+2
-1
miners.rake
lib/tasks/miners.rake
+41
-0
No files found.
config/schedule.rb
View file @
54f05aa2
set
:output
,
'log/cron.log'
every
(
"*/5 * * * *"
,
roles:
[
:app
])
{
rake
"miners:check_miners"
}
\ No newline at end of file
# every("*/5 * * * *", roles: [:app]) { rake "miners:check_miners" }
every
(
"*/5 * * * *"
,
roles:
[
:app
])
{
rake
"miners:check_safex_active_miner"
}
\ No newline at end of file
lib/tasks/miners.rake
View file @
54f05aa2
...
...
@@ -38,6 +38,47 @@ namespace :miners do
end
end
task
check_safex_active_miner: :environment
do
url
=
'http://pools.simbowear.com:8117/stats_address?address=Safex5ztaoiBsGxatonmfJfVvEufBEDrRNY4Ha2zTJrf8HSHrB8atKB55VPBAkwmrK6UQZsCNJmLLXKtumBPEEHw5FDrEYzDzWQ4S&longpoll=false'
response
=
HTTParty
.
get
(
url
)
response_json
=
JSON
.
parse
(
response
.
body
)
time
=
DateTime
.
now
miners
=
Miner
.
all
if
response_json
==
[]
miners
.
update_all
(
status:
Miner
::
STATUSES
[
0
])
end
puts
response_json
[
'workers'
][
0
][
'name'
]
miners
.
each
do
|
miner
|
if
miner
.
status
==
Miner
::
STATUSES
[
2
]
next
end
is_work
=
false
hr_stats
=
0
check_activity_time
=
(
DateTime
.
now
-
5
.
minutes
)
last_activity_time
=
miner
.
last_activity
||
check_activity_time
response_json
[
'workers'
].
each
do
|
item
|
if
item
[
'name'
]
==
miner
.
name
is_work
=
true
hr_stats
=
item
[
"hashrate"
]
puts
item
[
"hashrate"
]
break
end
end
if
is_work
miner
.
update
(
status:
Miner
::
STATUSES
[
1
],
hash_rate:
hr_stats
)
else
if
last_activity_time
<=
check_activity_time
miner
.
update
(
status:
Miner
::
STATUSES
[
0
],
last_activity:
time
,
hash_rate:
hr_stats
)
end
end
end
end
task
get_miners_data: :environment
do
session
=
GoogleDrive
::
Session
.
from_service_account_key
(
"client_secret.json"
)
spreadsheet
||=
session
.
spreadsheet_by_title
(
"bsa_miners"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment