Skip to content

Commit 6b97bd4

Browse files
author
Stefan Fleck
committed
resubmission that hopefully fixes sort order of files in cache on systems with low-accuracy timestamp
1 parent 28d1436 commit 6b97bd4

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: rotor
33
Title: Log Rotation and Conditional Backups
4-
Version: 0.3.1
4+
Version: 0.3.2
55
Authors@R:
66
person(given = "Stefan",
77
family = "Fleck",

R/Cache.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ Cache <- R6::R6Class(
333333
)
334334
row.names(res) <- NULL
335335

336-
res[order(res$mtime), ]
336+
assert(!is.null(res$mtime))
337+
res[order(res$mtime, res$key), ]
337338
},
338339

339340
size = function(){

cran-comments.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,12 @@
1010

1111
0 errors | 0 warnings | 0 notes
1212

13-
* fixes time zone related issue in `Cache$prune()` that causes macOS tests to fail
14-
* more robust cleanup of temporary files between some tests
15-
* resubmission that improves one test where
16-
`https://cran.r-project.org/web/checks/check_results_rotor.html` shows an
17-
error that I could not reproduce on any machine available on rhub.
18-
Hopefully the test succeedes now, but if not it will give me more useful
19-
debug information for another resubmission.
13+
Sorry for the many resubmissions. This package currently has an issue that
14+
only to occur on macOS. It does not occur on the same macOS version available
15+
on Rhub.
2016

21-
22-
Notes:
23-
24-
There was a timezone related issue that only occured on macos. I fixed it and
25-
was able to test it on macOS 10.13.6 High Sierra with R-release (but not devel)
26-
on Rhub.
27-
28-
I could not reproduce the other errors; however, it looks as if they were caused
29-
by improperly cleaned-up temporary files between failing tests. I made the
30-
cleanup code a bit more robust and hope the problem is fixed now.
17+
My current theory is that the error is caused by the accuracy of the
18+
'mtime' filestamp, which is linked to the file system the machine uses.
19+
I implemented a workaround under that assumption, but I cannot be 100% sure
20+
that this fixes that error. If the error still persists... could you please
21+
inform me which file system you use on r-release-macos-x86_64?

tests/testthat/test_Cache.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ test_that("pruning works by number of files works", {
7070
# be added to the cache once
7171
cache <- Cache$new(td, hashfun = function(x) uuid::UUIDgenerate())
7272
k1 <- cache$push(iris)
73-
Sys.sleep(1)
7473
k2 <- cache$push(letters)
75-
Sys.sleep(1)
7674
k3 <- cache$push(cars)
7775
expect_identical(cache$n, 3L)
7876

@@ -81,7 +79,6 @@ test_that("pruning works by number of files works", {
8179
expect_identical(cache$files$key[[3]], k3)
8280

8381
cache$prune(max_files = 2)
84-
cache$files
8582
expect_identical(cache$read(cache$files$key[[1]]), letters)
8683
expect_identical(cache$read(cache$files$key[[2]]), cars)
8784
cache$purge()

0 commit comments

Comments
 (0)