Rclone union poll-interval

I am trying to work out a method that allows me to use my existing rclone VFS mount that I only use with plex (and works perfectly), but also use it with sonarr and radarr. Sonarr and radarr need to be able to add and delete files. I was reading the documentation and I found the union command, which is great and thought I might be able to use that and then rclone move the files into the actual google remote after some period.

My idea was to create a union (This is on windows) like this:

type = union
remotes = gdrive2: Z:\rclone_upload

gdrive2: = unencrypted google drive remote
z:\ = local path

Then I mount with these options (Sorry for formatting, straight from a script):

$DriveLetter = 'P:'
$RcloneEXE = "c:\rclone\rclone.exe"
$RcloneConfig = "c:\rclone\.rclone.conf"
$RemotePath = 'gdrive2_local_union:'
$Log = 'C:\rclone\logs\Rclone-Mount.log'
$LogLevel = 'INFO'
if (!(Test-Path -Path $DriveLetter))
	& $RcloneEXE --config=$RcloneConfig mount $RemotePath $DriveLetter `
	--log-level $LogLevel `
	--log-file $Log `
	--dir-cache-time 12h `
	--buffer-size 64M `
	--vfs-read-chunk-size 128M `
	--vfs-read-chunk-size-limit 2G `

Now this seems to work fine, when I write a file to P: drive the file is written to the local path in the union. The issue occurs when I then rclone move a file from the local path to the actual remote. Once the move completes the file is no longer accessible in the mounted union until --dir-cache-time expires. I can see the file that has been moved but I can’t read it. the logs for the mount has this error:

2018/12/09 14:29:18 ERROR : IO error: open \\?\Z:\rclone_upload\Media\test\test.txt: The system cannot find the file specified.

This breaks the whole setup for me as plex can then see files that it can’t read properly until after the cache time expires.

I can see when you mount a union remote this is logged at the start

2018/12/09 14:26:51 INFO  : union root '': poll-interval is not supported by this remote
The service rclone has been started.

I suspect this is part of my issue, I think the poll interval is what takes care of these updates on a normal remote but I wanted to confirm with someone that understands this better than me. Is there a better way to do this? The union command seemed perfect for this until I ran into this problem.

Yes that is correct. We haven’t done poll-interval for the union remote. It would be straight forward to pass the read/write mount’s poll-inteval through though.

Would that solve your problem?

Yes I think that would solve my issue.

If you please make a new issue on github we can have a go at it - or maybe you’d like to help?

I have made an issue for it: https://github.com/ncw/rclone/issues/2837

It turned out to be a bug! I’ve posted a fix on the issue for you to try