Found in 1 comment on Hacker News
doctoboggan · 2022-11-08 · Original thread
Perihelion Summer[0] by Greg Egan is a great story with a similar premise (A black hole passing by the solar system and affecting earth's orbit)

[0]: https://amzn.to/3DNiUDj

Fresh book recommendations delivered straight to your inbox every Thursday.