lite-xl / lite-xl-plugin-manager

A lite-xl plugin manager.
Other
105 stars 16 forks source link

Avoid deleting ephemeral bottles if multiple instances are using them #99

Closed Guldoman closed 7 months ago

Guldoman commented 7 months ago

So if we execute multiple times

lpm run --ephemeral plugin1 plugin2 plugin3

only after closing all of the instances the bottle would be deleted.

Maybe a warning should be displayed when running multiple instances of the same ephemeral bottle.

Another possibility would be to generate a new hash if an instance is already occupying it.

adamharrison commented 7 months ago

Should be easy enough to do; we already have flock, so we can just store the count in a file in the bottle's folder to coordinate this.

adamharrison commented 7 months ago

Try f5d74c2. Not actually sure if we should do this; if lpm crashes, this would cause ephemeral bottles to never destruct, which I'm not a huge fan of. It also adds complexity for not so many reasons, really.

Maybe we should do the new hash thing?

Guldoman commented 7 months ago

if lpm crashes, this would cause ephemeral bottles to never destruct

I mean, wouldn't that happen in any case?

Maybe we should do the new hash thing?

If that sounds better, sure, go for it. I'm trying to think any case where I'd actually want to run two instances of the same ephemeral bottle, but I'm not finding any good one for now.

adamharrison commented 7 months ago

I mean, wouldn't that happen in any case?

Yes; but the next time you ran the ephemeral bottle and closed correctly, it'd destruct. As it stands with this system, because it's incrementing a counter in a lockfile, it'd never destruct.

If that sounds better, sure, go for it. I'm trying to think any case where I'd actually want to run two instances of the same ephemeral bottle, but I'm not finding any good one for now.

I think it's better, yeah. An ephemeral bottle should be isolated, even from other instances of itself, really. That's kinda the point. I'm going to change it to this.

adamharrison commented 7 months ago

OK, how's that?

Guldoman commented 7 months ago

Seems to work fine, thanks!