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
Dev #1
Open
katy-more-RSI
wants to merge
14
commits into
master
Choose a base branch
from
dev
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dev #1
Conversation
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
Adds a method to SlackIntegration.java that returns a formatted String to pass to Slack as a message
Currently there is an issue with the Mesonet API where the "weather condition" information hasn't been updated since October 30, so until it gets fixed it won't get included in Weatherbot's Slack response
This commit implements two separate threads, one to make API calls to the Mesonet API, and one to continually listen for Slack messages to respond to. This way there is no chance that a message will get skipped because the program is making the API call instead of listening for messages.
DenWav
requested changes
Nov 12, 2019
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.
I left a lot of comments to try and show you as much as I could but in general it does look good. :)
src/main/java/com/ruralsourcing/WeatherBot/model/Observation.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/model/ResponseModel.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/ApiTimerTask.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/ApiTimerTask.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/ApiTimerTask.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/SlackIntegration.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/SlackIntegration.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/SlackIntegration.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/SlackIntegration.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/SlackIntegration.java
Outdated
Show resolved
Hide resolved
rsi-toby
reviewed
Nov 12, 2019
src/main/java/com/ruralsourcing/WeatherBot/service/SlackIntegration.java
Outdated
Show resolved
Hide resolved
rsi-toby
approved these changes
Nov 12, 2019
Previously, API tokens for the Slack integration were stored as an environment variable, and the API token for the Mesonet API was hardcoded into the URL string. This commit places both tokens into a config.properties file and reads them from there, and puts config.properties into the .gitignore, so that API keys can remain separate and private among different users. config.sample.properties was created as a quick guide to the structure of the config.properties. The old API key that was hardcoded into the URL string has been disabled and replaced with a new key in the config.properties file for security purposes.
Abbreviation from String -> Str and Double -> Dbl was unneccesary
DenWav
requested changes
Nov 18, 2019
src/main/java/com/ruralsourcing/WeatherBot/service/PropertyIO.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/PropertyIO.java
Outdated
Show resolved
Hide resolved
src/main/java/com/ruralsourcing/WeatherBot/service/PropertyIO.java
Outdated
Show resolved
Hide resolved
In the PropertyIO class there were some best-practice issues that were fixed in this commit, such as an InputStream not in a try-with-resouces, a caught exception printing the error instead of the stack trace, and a potential race condition when the program starts
propertiesFileName will not be updated, so make it final. The properties variable isn't used outside of the constructore, so move the declaration inside the constructor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements threading and allows the program to simultaneously listen for Slack messages and ping the Mesonet API for updated data.