-
Notifications
You must be signed in to change notification settings - Fork 150
Remove scheduled save when during asset deletion, closes #90 #109
Remove scheduled save when during asset deletion, closes #90 #109
Conversation
added code inside asset deletion method to remove the pending callback fo its scheduled save
So my fix stops the callback from happening but I noticed that the object containing the scheduled saves never actually has entries removed from it until the server goes offline, all that happens is the values in it get null-ed out. Is this intentional? Seem's kind of like a memory leak in a sense because in the pathological case (adding tons of sprites /w images to your project) this is just going to grow and hang around for ever. Is there some purpose for that? If not, is it something work fixing? |
@@ -215,6 +215,14 @@ export default class RemoteProjectClient extends BaseRemoteClient { | |||
} | |||
} | |||
|
|||
// Cancel any scheduled save for this asset | |||
let scheduledSaveCallback = this.server.scheduledSaveCallbacks[`assets:${entry.id}`]; | |||
if (scheduledSaveCallback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer (scheduledSaveCallback != null)
Gave this some thought. Since assets on disk will be preserved in the
Yeah that looks wrong indeed. I can't think of a reason why we would rather null them out than deleting them. |
@elisee just to clarify we still want to remove the save from the scheduledsaves object but we just want to actually do the save then instead of just forgetting about it, correct? |
@chrisbubernak Yes that sounds like the correct approach. But since saves are async operations, we probably need to move the asset folder first and ensure that the save happens in the trashedAssets path. (This probably all ties in with #67 but we need not worry too much about it for now) |
So we are not deleting the scheduledCallback entry because it also store the last time it was saved. Thanks for helping out with that! |
Added code inside the asset deletion method to remove the pending callback from the scheduled save.