Public » MiniRedis Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

save files in background

Changeset 584e179782b1

Parent 12d0c38bccca

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at 584e179782b1 Showing diff from parent 12d0c38bccca Diff from another changeset...

Change 1 of 2 Show Entire File miniredis.py Stacked
 
137
138
139
140
141
142
143
 
237
238
239
240
 
 
 
 
 
 
241
242
243
 
137
138
139
 
140
141
142
 
236
237
238
 
239
240
241
242
243
244
245
246
247
@@ -137,7 +137,6 @@
  if self.db_file:   with open(self.db_file, 'wb') as f:   pickle.dump(self.tables, f, pickle.HIGHEST_PROTOCOL) - self.log(None, 'saved database to "%s"' % self.db_file)     def select(self, client, db):   if db not in self.tables: @@ -237,7 +236,12 @@
  return False     def handle_save(self, client): - self.save() + try: + if not os.fork(): + self.save() + sys.exit(0) + except OSError: + self.save()   self.log(client, 'SAVE')   return True