Skip to content

Commit

Permalink
Merge branch 'release/1.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Henjuro committed Jun 4, 2018
2 parents 96875e2 + 6914592 commit 529f4bc
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 22 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#Changelog
* 1.3.1
* Fixes
* fixed for possible race contition between checking if a character exists in db and creating it
* Fixed spelling anonymous as anonymouse in crossorigin
* Fix not beeing able to login with a transfered character
* Changes
* Not logging monolith errors to the error log anymore only to debug, these are expected
* Not logging fleet invite errors that are caused by a monolith error at all anymore
* 1.3.0
* Fixes
* Ban for character banned users did not work when esi was not responding
Expand Down
2 changes: 1 addition & 1 deletion static/js/themes/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ waitlist.themes = (function() {
'def_type': 'remote',
'def_file': 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css',
'def_integrity': "sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ",
'def_crossorigin': "anonymouse"
'def_crossorigin': "anonymous"
};
// file_name = null == standard file
function setTheme(file_name, type, integrity, crossorigin) {
Expand Down
4 changes: 2 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'def_type': 'remote',
'def_file': 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css',
'def_integrity': "sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ",
'def_crossorigin': "anonymouse"
'def_crossorigin': "anonymous"
};
// file_name = null == standard file
function setTheme(file_name, type, integrity, crossorigin) {
Expand Down Expand Up @@ -294,7 +294,7 @@
<option value="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"
data-type="remote"
data-integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
data-crossorigin="anonymouse">Generic</option>
data-crossorigin="anonymous">Generic</option>
</select>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion templates/settings/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<option value="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"
data-type="remote"
data-integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
data-crossorigin="anonymouse">Generic</option>
data-crossorigin="anonymous">Generic</option>
</select>
</footer >
{% endblock %}
Expand Down
4 changes: 3 additions & 1 deletion waitlist/blueprints/api/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def invite_to_fleet():
resp.status_code = status['status_code']

if resp.status_code != 204: # invite failed send no notifications
logger.error("Invited %s by %s into %s failed", character.eve_name, current_user.username, squad_type)
if resp.status_code != 520:
logger.error("Invited %s by %s into %s failed",
character.eve_name, current_user.username, squad_type)
return resp

send_notification(character_id, waitlist_id)
Expand Down
2 changes: 1 addition & 1 deletion waitlist/data/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.2.3-$Format:%h$"
version = "1.3.1-$Format:%h$"
36 changes: 22 additions & 14 deletions waitlist/utility/eve_id_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
from waitlist.utility.swagger import get_api
from waitlist.utility.swagger.eve import get_esi_client
from waitlist.utility.swagger.eve.search import SearchEndpoint, SearchResponse
from threading import Lock

logger = logging.getLogger(__name__)

"""
Lock for checking existance of a character and creating it
"""
character_check_lock: Lock = Lock()


def get_constellation(name: str) -> Constellation:
return db.session.query(Constellation).filter(Constellation.constellationName == name).first()
Expand Down Expand Up @@ -81,7 +87,7 @@ def get_account_from_db(int_id: int) -> Account:

# load a character by its id
def get_char_from_db(int_id: int) -> Character:
return db.session.query(Character).filter(Character.id == int_id).first()
return db.session.query(Character).get(int_id)


def create_new_character(eve_id: int, char_name: str) -> Character:
Expand All @@ -95,23 +101,25 @@ def create_new_character(eve_id: int, char_name: str) -> Character:


def get_character_by_id_and_name(eve_id: int, eve_name: str) -> Character:
char = get_char_from_db(eve_id)
if char is None:
logger.info("No character found for id %d", eve_id)
# create a new char
char = create_new_character(eve_id, eve_name)
with character_check_lock:
char = get_char_from_db(eve_id)
if char is None:
logger.info("No character found for id %d", eve_id)
# create a new char
char = create_new_character(eve_id, eve_name)

return char
return char


def get_character_by_id(eve_character_id: int) -> Character:
character: Character = get_char_from_db(eve_character_id)
if character is None:
logger.info("No character found in database for id %d", eve_character_id)
char_info = outgate.character.get_info(eve_character_id)
character = create_new_character(eve_character_id, char_info.characterName)

return character
with character_check_lock:
character: Character = get_char_from_db(eve_character_id)
if character is None:
logger.info("No character found in database for id %d", eve_character_id)
char_info = outgate.character.get_info(eve_character_id)
character = create_new_character(eve_character_id, char_info.characterName)

return character


def is_charid_banned(character_id: int) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion waitlist/utility/login/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def login_character(char: Character, owner_hash: str, token: SSOToken) -> Respon
# if the hash is there but different the owner changed we need to invalidate sessions and update
elif char.owner_hash != owner_hash:
char.owner_hash = owner_hash
invalidate_all_sessions_for_current_user()
invalidate_all_sessions_for_given_user(char)
db.session.commit()

tokens = char.get_sso_tokens_with_scopes(['publicData'])
Expand Down
4 changes: 3 additions & 1 deletion waitlist/utility/swagger/eve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ def make_error_response(resp: Any) -> ESIResponse:
msg = resp.data['error']
else:
msg = f'Unknown Monolith error {resp.data}'

logger.debug('ESI responded with status Monolith 520 and msg %s', msg)
else:
msg = resp.data['error'] if resp.data is not None and 'error' in resp.data else 'No error data send'
logger.error(f'ESI responded with status {resp.status} and msg {msg}')
logger.error('ESI responded with status %s and msg %s', resp.status, msg)
return ESIResponse(get_expire_time(resp), resp.status, msg)


Expand Down

0 comments on commit 529f4bc

Please sign in to comment.