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
94740c66
Commit
94740c66
authored
Mar 16, 2023
by
nazarf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix check miners
parent
17e00c6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
miners.rake
lib/tasks/miners.rake
+3
-2
No files found.
lib/tasks/miners.rake
View file @
94740c66
...
@@ -4,7 +4,7 @@ namespace :miners do
...
@@ -4,7 +4,7 @@ namespace :miners do
response
=
HTTParty
.
get
(
url
)
response
=
HTTParty
.
get
(
url
)
response_json
=
JSON
.
parse
(
response
.
body
)
response_json
=
JSON
.
parse
(
response
.
body
)
time
=
DateTime
.
n
e
w
time
=
DateTime
.
n
o
w
miners
=
Miner
.
all
miners
=
Miner
.
all
if
response_json
==
[]
if
response_json
==
[]
...
@@ -17,6 +17,7 @@ namespace :miners do
...
@@ -17,6 +17,7 @@ namespace :miners do
is_work
=
false
is_work
=
false
hr_stats
=
0
hr_stats
=
0
check_activity_time
=
(
DateTime
.
now
-
5
.
minutes
)
check_activity_time
=
(
DateTime
.
now
-
5
.
minutes
)
last_activity_time
=
miner
.
last_activity
||
check_activity_time
response_json
.
each
do
|
item
|
response_json
.
each
do
|
item
|
if
item
[
'work_id'
]
==
miner
.
name
if
item
[
'work_id'
]
==
miner
.
name
...
@@ -29,7 +30,7 @@ namespace :miners do
...
@@ -29,7 +30,7 @@ namespace :miners do
if
is_work
if
is_work
miner
.
update
(
status:
'work'
,
hash_rate:
hr_stats
)
miner
.
update
(
status:
'work'
,
hash_rate:
hr_stats
)
else
else
if
miner
.
last_activity
<
check_activity_time
if
last_activity_time
<=
check_activity_time
miner
.
update
(
status:
'miss'
,
last_activity:
time
,
hash_rate:
hr_stats
)
miner
.
update
(
status:
'miss'
,
last_activity:
time
,
hash_rate:
hr_stats
)
end
end
end
end
...
...
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