Otann / morse

📡 Clojure interface for Telegram Bot API
Eclipse Public License 1.0
257 stars 48 forks source link

Library restructuring #57

Closed marksto closed 3 years ago

marksto commented 3 years ago

Improve the overall structure of the library codebase:

Update the test coverage to reflect the changes in structure

Update the project.clj

marksto commented 3 years ago

Tested with my bot, everything works fine after minor changes to require and function names. My status checker functionality works as expected, as can be seen from the logs.

2021-07-02T18:50:38.032Z UnknownHost INFO [org.eclipse.jetty.server.Server:415] - Started @41406ms
2021-07-02T18:50:38.059Z UnknownHost INFO [general-expenses-accountant.web-server:30] - Successfully started the Server@6a3ac22f{STARTED}[9.4.36.v20210114]
2021-07-02T18:50:38.231Z UnknownHost INFO [morse.updates.polling:286] - Starting Telegram polling...
2021-07-02T18:50:38.238Z UnknownHost INFO [general-expenses-accountant.main:31] - The app has been successfully initialized!
2021-07-02T18:50:38.242Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 1 sec...
Loaded
2021-07-02T18:50:39.249Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T18:50:39.250Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...
2021-07-02T18:50:59.253Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T18:50:59.254Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...
2021-07-02T18:51:19.255Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T18:51:19.255Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...
2021-07-02T18:51:39.256Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T18:51:44.258Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...

Even after simulating a network error:

2021-07-02T19:00:19.379Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T19:00:24.385Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...
2021-07-02T19:00:31.413Z UnknownHost WARN [morse.updates.polling:286] - Got error from Telegram API, stopping polling
2021-07-02T19:00:44.389Z UnknownHost TRACE [general-expenses-accountant.tg-client:176] - Checking the status... NOT POLLING!
2021-07-02T19:00:44.391Z UnknownHost TRACE [general-expenses-accountant.tg-client:182] - Trying to restart #1 of 5
2021-07-02T19:00:44.392Z UnknownHost INFO [morse.updates.polling:286] - Stopping Telegram polling...
2021-07-02T19:00:45.393Z UnknownHost INFO [morse.updates.polling:286] - Starting Telegram polling...
2021-07-02T19:00:45.394Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 10 sec...
2021-07-02T19:00:47.397Z UnknownHost WARN [morse.updates.polling:286] - Got error from Telegram API, stopping polling
2021-07-02T19:00:55.395Z UnknownHost TRACE [general-expenses-accountant.tg-client:176] - Checking the status... NOT POLLING!
2021-07-02T19:00:55.395Z UnknownHost TRACE [general-expenses-accountant.tg-client:182] - Trying to restart #2 of 5
2021-07-02T19:00:55.396Z UnknownHost INFO [morse.updates.polling:286] - Stopping Telegram polling...
2021-07-02T19:00:56.398Z UnknownHost INFO [morse.updates.polling:286] - Starting Telegram polling...
2021-07-02T19:00:56.398Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 10 sec...
2021-07-02T19:00:58.403Z UnknownHost WARN [morse.updates.polling:286] - Got error from Telegram API, stopping polling
2021-07-02T19:01:06.401Z UnknownHost TRACE [general-expenses-accountant.tg-client:176] - Checking the status... NOT POLLING!
2021-07-02T19:01:06.402Z UnknownHost TRACE [general-expenses-accountant.tg-client:182] - Trying to restart #3 of 5
2021-07-02T19:01:06.404Z UnknownHost INFO [morse.updates.polling:286] - Stopping Telegram polling...
2021-07-02T19:01:07.408Z UnknownHost INFO [morse.updates.polling:286] - Starting Telegram polling...
2021-07-02T19:01:07.408Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 10 sec...
2021-07-02T19:01:17.409Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T19:01:17.410Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...
2021-07-02T19:01:37.410Z UnknownHost TRACE [general-expenses-accountant.tg-client:188] - Checking the status... polling [OK]
2021-07-02T19:01:42.413Z UnknownHost TRACE [general-expenses-accountant.tg-client:172] - Waiting for 20 sec...

Magic? o_O

codecov[bot] commented 3 years ago

Codecov Report

Merging #57 (dd74148) into master (bbb2efc) will increase coverage by 1.90%. The diff coverage is 67.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #57      +/-   ##
==========================================
+ Coverage   70.61%   72.52%   +1.90%     
==========================================
  Files           3        4       +1     
  Lines         194      222      +28     
  Branches       17       17              
==========================================
+ Hits          137      161      +24     
- Misses         40       44       +4     
  Partials       17       17              
Impacted Files Coverage Δ
src/morse/updates/polling.clj 60.00% <60.00%> (ø)
src/morse/api.clj 73.72% <67.18%> (+0.39%) :arrow_up:
src/morse/handlers.clj 78.04% <72.22%> (+1.73%) :arrow_up:
src/morse/updates/api.clj 78.26% <78.26%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bbb2efc...dd74148. Read the comment docs.

marksto commented 3 years ago

@Otann, would you like the code style/CI commits go in a separate PR (e.g. to customize the style rules)? But we'll have to merge this PR in the first place (w/o the last 6 commits, of course).