chchch / upama

A PHP library for comparing two or more Sanskrit TEI XML files and generating an apparatus with variants
GNU General Public License v2.0
10 stars 1 forks source link

upama cache needs periodic flushing #88

Open wujastyk opened 2 months ago

wujastyk commented 2 months ago

Running upama/dokuwiki/apache2 on my local laptop.

I find sometimes generating an apparatus does not use the latest versions of the files in data/pages. It seems, rather, to be pulling data from /var/www/html/dokuwiki/data/cache/upama. If I delete that cache/upama folder and re-generate the apparatus, it correctly collates the files in data/pages.

Dominik

chchch commented 2 months ago

Upama checks the timestamp of the cache files and compares them with the files in data/pages... it could be that the timestamps of your pages aren't being updated?

wujastyk commented 2 months ago

Hmm. The files are being updated, but the files in /var/www are hard links to the main file directory in my working area. I'll look into whether the time stamp of linked files are updated when the other file is updated.

<few minutes later> I think that's not it. I'm updating the main files; the content of the files linked by ln to the main files is being updated and their timestamps are also updated. And saktumiva displays the updated, linked file just fine.

It's something else. Maybe Dropbox (my "main" files are in a Dropbox folder and get updated by Dropbox when I'm working on another machine). I have a feeling that files updated by Dropbox have their ln links broken.

I'll keep checking.

Is there a downside to deleting the upama/cache directory? I've not noticed a downside so far.

wujastyk commented 1 month ago

This morning there was a particularly clear case. In my provisional ed., I had a reading "ullika". In an older version of the file, there had been a reading "ullikajā". I had corrected it. The file in /var/www definitely reads "ullika". I load the file into Saktumiva, running locally, and I see "ullika". I collate the MSS, and the reading reverts to "ullikajā". That must be coming from some old cache. Refreshing the screen etc. doesn't cure the problem.

Deleting /var/www/html/dokuwiki/data/cache/upama and re-collating fixed the problem.

https://github.com/user-attachments/assets/ebe79cd9-ff4a-498d-a59f-0786f4ce1f5a

chchch commented 1 month ago

Hmm yes maybe check the timestamps on your files in /var/www; do they get updated when you update a file? There's no problem with clearing the cache -- it just makes the collation take a bit longer.

wujastyk commented 1 month ago

The files in /var/www are hard-linked to the files in my main project directory, elsewhere on my disk.
When I open my file system manager (Nemo) with two display windows and update a project file, the windown showing the project file updates the date immediately. But the window showing the hard-linked files does not update the timestamp until I refresh the window. I don't know what this means. Is it an artefact of the file manager? Or is there something about file synchronization happening because of the hard-linking. The time-stamp is updated, but it doesn't display as updated until the display refresh. Could something like this be affecting the Upama cache?