small clean ups
This commit is contained in:
@@ -151,7 +151,6 @@ async def run(program_args):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print('Tweets were not retrieved cleanly.')
|
print('Tweets were not retrieved cleanly.')
|
||||||
# os.remove(queue_path) # keep backup queue
|
|
||||||
return False
|
return False
|
||||||
except:
|
except:
|
||||||
print('Unhandled error occurred while running catch up in posting phase.')
|
print('Unhandled error occurred while running catch up in posting phase.')
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ class TalentTweetQueue:
|
|||||||
|
|
||||||
## file check, backup copy
|
## file check, backup copy
|
||||||
if os.path.exists(self.queue_backup_path):
|
if os.path.exists(self.queue_backup_path):
|
||||||
print('Found old backup queue! We errored in the previous run.')
|
print('Found backup queue! We errored in the previous run.')
|
||||||
shutil.copyfile(self.queue_backup_path, self.queue_path)
|
shutil.copyfile(self.queue_backup_path, self.queue_path)
|
||||||
elif os.path.exists(self.queue_path):
|
elif os.path.exists(self.queue_path):
|
||||||
print('Creating backup queue...')
|
print('Creating backup queue...')
|
||||||
@@ -77,6 +77,7 @@ class TalentTweetQueue:
|
|||||||
return self.ttweets_dict[id]
|
return self.ttweets_dict[id]
|
||||||
|
|
||||||
def get_next_ttweet(self):
|
def get_next_ttweet(self):
|
||||||
|
self.is_good = False
|
||||||
if os.path.exists(self.current_ttweet_path):
|
if os.path.exists(self.current_ttweet_path):
|
||||||
with open(self.current_ttweet_path, 'r') as f:
|
with open(self.current_ttweet_path, 'r') as f:
|
||||||
return tt.TalentTweet.deserialize(f.readline())
|
return tt.TalentTweet.deserialize(f.readline())
|
||||||
@@ -86,7 +87,6 @@ class TalentTweetQueue:
|
|||||||
ttweet = self.ttweets_dict.pop(key)
|
ttweet = self.ttweets_dict.pop(key)
|
||||||
with open(self.current_ttweet_path, 'w') as f:
|
with open(self.current_ttweet_path, 'w') as f:
|
||||||
f.write(ttweet.serialize())
|
f.write(ttweet.serialize())
|
||||||
self.is_good = False
|
|
||||||
return ttweet
|
return ttweet
|
||||||
|
|
||||||
def get_count(self):
|
def get_count(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user