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

deleting app might take a little time #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
31 changes: 26 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#Alias
alias = config.alias

# time out max 2when get workitem status
# time out max
TIMEOUT = 10 * 60 # 10min

#default width
Expand All @@ -51,6 +51,7 @@
width = args.width
height = args.height


### 0. get bundle
file_list=os.listdir(appPackagePath)
index = 0
Expand Down Expand Up @@ -89,15 +90,35 @@
print('---Check nick name...')

nickname = forge_da.getNickName()
print('nick name: ' + nickname)
print('current nick name: ' + nickname)
if nickname == None:
quit()
if nickname == config.Forge_CLIENT_ID :

print('Would you like to delete existing nickname and reset with <' + nickname +'>?'
'WARNING! deleting current nick name will delete ALL your personal activities and appbundles!!')
variable = input('Y/N: ')

if variable == 'Y' or variable == 'y':
print('delete nick name: ' + nickname)
#set desired nick name
if forge_da.deleteNickName(nickname) == None:
quit()
if forge_da.setNickName(desired_nickname) == None:
quit()
#since deleting might take time, wait until it is done
print('since deleting might take a little time, set nickname can only work when deleting has done. ')
res = forge_da.setNickName(desired_nickname)
start_time = time.time()
last_ticktime = start_time
while res == None:
print('trying to set again..')
#call one more time after 5 seconds, instead of frequent calling
if time.time() - last_ticktime > 5:
last_ticktime = time.time()
res = forge_da.setNickName(desired_nickname)
#total time of the looping
elapsed_time = time.time() - start_time
if elapsed_time > TIMEOUT:
print('TIMEOUT to set nickname!')
quit()

nickname = forge_da.getNickName()
if nickname == None:
Expand Down