This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
feat: sync wallet data #2748
Merged
Merged
feat: sync wallet data #2748
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e8da4ca
feat: add scheduler service
clucasalcantara 327e7ba
fix: fix types
clucasalcantara 20f0f60
feat: apply sync on initialize, run scheduler
clucasalcantara b3218ba
refactor: remove other calls for sync due to initialization and sched…
clucasalcantara abd0752
wip
8c0b863
style: resolve style guide violations
faustbrian 6dcd373
Merge branch '3.0-react' into feat/sync-wallet-data
1fefb17
Merge branch '3.0-react' into feat/sync-wallet-data
faustbrian a6b54b5
Merge branch '3.0-react' into feat/sync-wallet-data
clucasalcantara b689f53
Merge branch '3.0-react' into feat/sync-wallet-data
faustbrian eba6f19
chore: add nock for crypto compare
clucasalcantara 67be21b
Merge branch '3.0-react' into feat/sync-wallet-data
faustbrian 841d20a
Merge branch '3.0-react' into feat/sync-wallet-data
3e5156b
wip
275679c
tests: update snapshots
clucasalcantara 1f8b02c
tests: wip fix address tests
clucasalcantara 7ccf4cb
fix: duplicatated import
clucasalcantara b26407b
tests: update snapshots
clucasalcantara e42e893
Merge branch '3.0-react' into feat/sync-wallet-data
ffcfcba
wip
2d1afa0
style: resolve style guide violations
faustbrian 6d344ef
Merge branch '3.0-react' into feat/sync-wallet-data
faustbrian 0e1ee21
tests: ignore temp console error in tests
clucasalcantara 103799a
tests: update tests and increse coverage
clucasalcantara 607e189
feat: add echange ratwes sync
clucasalcantara 51feaad
chore: use promise all settled
clucasalcantara 289527c
chore: rename sync function for wallets data
clucasalcantara 5a74b10
wip
0756d25
Merge branch '3.0-react' into feat/sync-wallet-data
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Scheduler } from "./Scheduler"; | ||
|
||
describe("Scheduler test", () => { | ||
jest.useFakeTimers(); | ||
|
||
it("should run an action after an determined interval", () => { | ||
const action = jest.fn(); | ||
Scheduler(100).schedule([action]); | ||
jest.advanceTimersByTime(100); | ||
expect(action).toHaveBeenCalled(); | ||
}); | ||
|
||
it("should run an action using the default interval", () => { | ||
const action = jest.fn(); | ||
Scheduler().schedule([action]); | ||
jest.advanceTimersByTime(300000); | ||
expect(action).toHaveBeenCalled(); | ||
}); | ||
|
||
it("should run actions and the done callback", () => { | ||
const action = jest.fn(); | ||
const done = jest.fn(); | ||
Scheduler().schedule([action], done); | ||
|
||
jest.advanceTimersByTime(300500); | ||
expect(action).toHaveBeenCalled(); | ||
expect(done).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const Scheduler = (interval = 300000) => ({ | ||
schedule: (actions: any, done: Function) => { | ||
for (const action of actions) { | ||
console.log(`Scheduling action ${action.name} for every ${interval / 60000} mins`); | ||
|
||
setInterval(() => action(), interval); | ||
|
||
// Run a done action once all timers runned | ||
return done && setTimeout(() => done(), interval + 500); | ||
} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { HttpClient } from "./HttpClient"; | ||
|
||
export const httpClient = new HttpClient(10); | ||
|
||
export * from "./Scheduler"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions should always be
camelCase
and classesPascalClass
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that we should create a class instead of just a function in this case to explicit that the Scheduler should be
service/module
? 🤔