Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject a clock instead of mocking currentTimeMS #2996

Closed
christophsturm opened this issue Jul 24, 2019 · 7 comments
Closed

Inject a clock instead of mocking currentTimeMS #2996

christophsturm opened this issue Jul 24, 2019 · 7 comments

Comments

@christophsturm
Copy link
Contributor

time is a dependency like any other and it needs to be injected where needed.
see https://docs.oracle.com/javase/8/docs/api/java/time/Clock.html
https://github.com/robfletcher/test-clock

@mrosseel
Copy link
Member

would indeed be better for unit testing, any idea of the impact of this change?

@christophsturm
Copy link
Contributor Author

will probably be a big diff but it does not really change any logic, so it should be safe.
one additional issue is that we already have a class called "clock", that should probably be renamed to SecondsScheduler or something.
I can do both in separate prs. if people agree that its worthwile

@sqrrm
Copy link
Member

sqrrm commented Jul 24, 2019

While it's nice to clean up the code I wonder if it's really worthwhile right now. I see issues with current trade protocol and performance issues as more urgent. People are having problem at startup with the app not starting or being very slow and there are a few bugs out there causing people to lose money trying to initiate trades or transactions failing for unclear reasons.

This kind of refactor is probably a lot easier to understand though, and perhaps a good start rather than diving straight into the most sensitive parts of the code. All depends on how much work and the risk to stability.

@christophsturm
Copy link
Contributor Author

I'm just writing issues as I notice problems, so others can chime in with their opinion.

@sqrrm
Copy link
Member

sqrrm commented Jul 24, 2019

Yes, that's how I understood it. I'm adding my opinion on where effort is probably best spent at this point. I think it's good that you open these issues and I don't disagree with the issue itself.

@stale
Copy link

stale bot commented Dec 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the was:dropped label Dec 18, 2019
@stale
Copy link

stale bot commented Dec 25, 2019

This issue has been automatically closed because of inactivity. Feel free to reopen it if you think it is still relevant.

@stale stale bot closed this as completed Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants