CoreData sqlite-wal file not emptying on checkpoint.

Hi,
I have a CoreData based app using NSPersistenCloudKitContainer with SwiftUI. Works fine with small datasets. However there are images stored as BLOBs which increases the size significantly eventually.
The problem is that force checkpointing fails to reliably empty the large -wal file, which can reach several hundred MB or GB+ before a checkpoint is done. No amont of pragma settings will override Coredata's apparent reluctance to checkpoint sooner! Then when it does checkpoint (reliably at app start), it fails to clear the -wal file anyway!

Consequently, subsequent uses after a checkpoint are all needing force checkpointing again, uncessarily as the main sqlite file now has all the updated data. This will freeze the app for a considerable period (many seconds) and is an unacceptable user experience.

Despite many suggestions from Dr. Google I have been unable to overcome CoreData's inability to empty the -wal file, (or to persuade it to checkpoint at smaller file sizes to avoid a freeze).

The issue seems to only occur on real devices, whilst on the sim the -wal file is properly emptied by a checkpoint. Any ideas on how to make sure that the -wal file is emptied after a force checkpoint or any pointers as to why this is happening?
Thanks
I'm having the same problem. Have you found a workaround for it?
Hi
Ive started using the external storage option for the BLOBS which is what I should have done from the start if I’d realised how many items would be stored !
this massively reduces the size of the database files and thus the wal files too. So it effectively avoids the problem altogether.
CoreData sqlite-wal file not emptying on checkpoint.
 
 
Q