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

Patch to resolve a potential issue where games can be reported to galaxy before it is ready to accept them #57

Merged
merged 2 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Python package

on:
push:
branches: [ readlocal ]
branches: [ readlocal,master ]
pull_request:
branches: [ readlocal ]
branches: [ readlocal,master ]

jobs:
build:
Expand Down
22 changes: 14 additions & 8 deletions src/itch.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, reader, writer, token):
self.myLocalClientDbReader = localClientDbReader()

self.time_last_update = datetime.now()
self.my_handshook=False

async def shutdown(self):
await self.http_client.close()
Expand Down Expand Up @@ -73,6 +74,10 @@ async def pass_login_credentials(self, step, credentials, cookies):
logging.debug(user.get("username"))
return Authentication(str(user.get("id")), str(user.get("username")))

def handshake_complete(self):
logging.info("Handshake complete")
self.my_handshook=True

async def get_owned_games(self):
whitelist = await load_whitelist_from_file()
page = 1
Expand Down Expand Up @@ -154,14 +159,15 @@ def tick(self) -> None:
# logging.error(my_game_sending)
# self.add_game(my_game_sending)
# my_counter = my_counter+1

my_mod_delta = math.floor(time_delta_seconds/7)
my_counter = 0
while my_mod_delta > 0 and my_counter < 101 and not self.myLocalClientDbReader.my_queue_update_local_game_status.empty():
my_game_update_sending = self.myLocalClientDbReader.my_queue_update_local_game_status.get()
logging.error(my_game_update_sending)
self.update_local_game_status(my_game_update_sending)
my_counter = my_counter+1
#make sure to only send updates after handshake is completed
if (self.my_handshook):
my_mod_delta = math.floor(time_delta_seconds/7)
my_counter = 0
while my_mod_delta > 0 and my_counter < 101 and not self.myLocalClientDbReader.my_queue_update_local_game_status.empty():
my_game_update_sending = self.myLocalClientDbReader.my_queue_update_local_game_status.get()
logging.error(my_game_update_sending)
self.update_local_game_status(my_game_update_sending)
my_counter = my_counter+1

async def get_local_games(self) -> List[LocalGame]:
logging.info("galaxy update local installed")
Expand Down