#5895: Limit number of worksheet snapshots
----------------------+-----------------------------------------------------
Reporter: rbeezer | Owner: rbeezer
Type: defect | Status: new
Priority: major | Milestone: sage-3.4.2
Component: notebook | Keywords:
----------------------+-----------------------------------------------------
Comment(by was):
You *MUST* change this code:
{{{
1945 path = self.snapshot_directory()
1946 snapshots = os.listdir(path)
1947 snapshots.sort()
1948 if len(snapshots) == (max_snaps + 1):
1949 os.remove(os.path.join(path, snapshots[0]))
}}}
Change the line "if len(snapshots) == (max_snaps + 1):" to
{{{
while len(snapshots) > max_snaps:
}}}
It reads better, will work, *and* will avoid subtle race conditions. The
way you have stuff setup in this patch, if there is ever a situation where
two snapshots are made, but this function isn't called (e.g., due to some
weird race conditions), then one goes back to having potentially thousands
of snapshots.
Also, I see no reason to not delete snapshots from old worksheets too. In
fact, I very much hope that when I apply this patch, then directories with
tons of snapshots on sagenb.org and my laptop will have their excessive
snapshots deleted, at least if the corresponding worksheets are used.
William
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5895#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---