Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
7736b4df
Commit
7736b4df
authored
Oct 17, 2018
by
Clint Mourlevat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing ticker service for first check
parent
6c3ec9b6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
HomeController.cs
Controllers/HomeController.cs
+1
-1
TickerService.cs
Services/TickerService.cs
+3
-1
No files found.
Controllers/HomeController.cs
View file @
7736b4df
...
@@ -19,7 +19,7 @@ namespace Stratis.Guru.Controllers
...
@@ -19,7 +19,7 @@ namespace Stratis.Guru.Controllers
{
{
public
class
HomeController
:
Controller
public
class
HomeController
:
Controller
{
{
private
IMemoryCache
_memoryCache
;
private
readonly
IMemoryCache
_memoryCache
;
public
HomeController
(
IMemoryCache
memoryCache
)
public
HomeController
(
IMemoryCache
memoryCache
)
{
{
...
...
Services/TickerService.cs
View file @
7736b4df
...
@@ -20,13 +20,15 @@ namespace Stratis.Guru.Services
...
@@ -20,13 +20,15 @@ namespace Stratis.Guru.Services
public
Task
StartAsync
(
CancellationToken
cancellationToken
)
public
Task
StartAsync
(
CancellationToken
cancellationToken
)
{
{
var
updateTimer
=
new
System
.
Timers
.
Timer
();
var
updateTimer
=
new
System
.
Timers
.
Timer
();
updateTimer
.
Interval
=
10000
;
updateTimer
.
Interval
=
10
;
updateTimer
.
Enabled
=
true
;
updateTimer
.
Elapsed
+=
(
sender
,
args
)
=>
updateTimer
.
Elapsed
+=
(
sender
,
args
)
=>
{
{
var
coinmarketCapApiClient
=
new
RestClient
(
"https://api.coinmarketcap.com/v2/ticker/1343/"
);
var
coinmarketCapApiClient
=
new
RestClient
(
"https://api.coinmarketcap.com/v2/ticker/1343/"
);
var
coinmarketCapApiRequest
=
new
RestRequest
(
Method
.
GET
);
var
coinmarketCapApiRequest
=
new
RestRequest
(
Method
.
GET
);
var
coinmarketcapApi
=
coinmarketCapApiClient
.
Execute
(
coinmarketCapApiRequest
);
var
coinmarketcapApi
=
coinmarketCapApiClient
.
Execute
(
coinmarketCapApiRequest
);
_memoryCache
.
Set
(
"Coinmarketcap"
,
coinmarketcapApi
.
Content
);
_memoryCache
.
Set
(
"Coinmarketcap"
,
coinmarketcapApi
.
Content
);
updateTimer
.
Interval
=
TimeSpan
.
FromMinutes
(
10
).
TotalMilliseconds
;
};
};
updateTimer
.
Start
();
updateTimer
.
Start
();
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
...
...
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