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

Dev #1

Open
wants to merge 14 commits into
base: master
from
Open

Dev #1

wants to merge 14 commits into from

Conversation

@katy-more-RSI
Copy link
Owner

katy-more-RSI commented Nov 12, 2019

This PR implements threading and allows the program to simultaneously listen for Slack messages and ping the Mesonet API for updated data.

katy-more-RSI and others added 6 commits Oct 31, 2019
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.
@katy-more-RSI katy-more-RSI requested review from DemonWav and rsi-toby Nov 12, 2019
@katy-more-RSI katy-more-RSI self-assigned this Nov 12, 2019
Copy link
Collaborator

DemonWav left a comment

I left a lot of comments to try and show you as much as I could but in general it does look good. :)

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
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
Projects
None yet
3 participants
You can’t perform that action at this time.