Proper way to delete annotation

Hello everyone!

So, I've built a super simple tile management system by storing the tile's ids in annotations. My problem is with removing the tile id from annotation.

I have the following code:

KEY = 'ufal.tiles.carroussel'
index = '56636f3d646748f599261cd180cc13fb'
annotations = IAnnotations(context)
tiles = annotations.get(KEY, [])
del tiles[index]

This code executes without errors in local development.
If I check annotations in the same context, the value is no longer there.

The problem is that, in production, that value sometimes "comes back".
I have to keep trying to remove it, running the code in each instance a few times to make sure it doesn't "comes back".

Is there a proper way to remove annotations?

Is the tiles thingy a PersistentMapping?
If not, then you'll need to assign tiles back into the annotations.

tiles = annotations.get(KEY, [])
del tiles[index]
annotations[KEY] = tiles

That makes total sense.
Let me try!