Refresh not acurate

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
rienvanham
Junior Member
Junior Member
Posts: 18
Joined: 2014-01-11, 11:45 UTC

Refresh not acurate

Post by *rienvanham »

Very often I'm watching a folder where an application puts files in and removes them after a while (we use this folder as a kind of a queue). Very often a (ghost)file is left behind: Total Commander keeps showing this file (but it isn't actually present on the disk). After a "manual" refresh (CTRL + R) the (ghost)file is gone.

Why is this? Thanks in advance!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Refresh not acurate

Post by *ghisler(Author) »

This can happen when a file is created or deleted while Total Commander is completely r-reading a directory, e.g. because you switch to it.
Example:
1. Switch from busy app to Total Commander
2. Total Commander stops watching for directory changes
3. Total Commander re-reads current directory
4. Total Commander starts again watching for directory changes

Now if something is changed during step 3, it's possible that Windows doesn't yet reflect the change until step 3 has finished.
Author of Total Commander
https://www.ghisler.com
rienvanham
Junior Member
Junior Member
Posts: 18
Joined: 2014-01-11, 11:45 UTC

Re: Refresh not acurate

Post by *rienvanham »

Hi Christian,

Thanks for your response but I can't agree with you:

I'm watching the content of the folder in Total Commander WITHOUT leaving TC (as a kind of static viewing).
- Application 1 creates the files (they appear in the list);
- Application 2 removes (after a while) the files;
- Total Commander is updating the filelist (I see the changes every few seconds);
- But sometimes it leaves 1 or more files behind;
- And the list keeps updating..... but the "ghost"-keeps present until a manual CTRL-R is issued.

I'm trying to make some screenshots today.

Thanks in advance!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Refresh not acurate

Post by *ghisler(Author) »

How many files per second are being created/deleted? I have read somewhere that the notification queue can overflow if there are too many updates per second, so programs will not be informed about all changes.
Author of Total Commander
https://www.ghisler.com
rienvanham
Junior Member
Junior Member
Posts: 18
Joined: 2014-01-11, 11:45 UTC

Re: Refresh not acurate

Post by *rienvanham »

Hi Christian,

That might be the case! sometimes a few 100's of files are created in a second en deleted after a few seconds. (it's actually a receive-folder for a system that processes more than 100.000 files during the day).

But what I don't get it that de "ghost"-file is gone after a CTRL-R. That sounds like that there is a difference between "auto" and "manual" refresh? Is it possible that the "auto" refresh invokes the same code as "manual" refresh?

Thanks in advance,

Cheers!

Rien.

Oh, I think I know (part of) the answer: "auto"-refresh is a filesystemwatcher? and "manual"-refresh does a file-listing?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Refresh not acurate

Post by *ghisler(Author) »

Ctrl+R makes a full refresh by reading the entire directory via FindFirstFile/FindNextFile/FindClose loop. Watch directory changes doesn't do a full refresh. It listens to Windows messages about added/removed files, and adds them dynamically with a small delay.
Author of Total Commander
https://www.ghisler.com
rienvanham
Junior Member
Junior Member
Posts: 18
Joined: 2014-01-11, 11:45 UTC

Re: Refresh not acurate

Post by *rienvanham »

Thank you!
Post Reply