File tree 4 files changed +13
-14
lines changed 4 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import '../shared/task_scheduler.dart';
11
11
import '../shared/task_sources.dart' ;
12
12
import '../shared/versions.dart' ;
13
13
14
+ import 'backend.dart' show reanalyzeThreshold;
14
15
import 'models.dart' ;
15
16
16
17
/// Creates a task when a version uploaded in the past 10 minutes has no
@@ -32,13 +33,14 @@ class AnalyzerDatastoreHeadTaskSource extends DatastoreHeadTaskSource {
32
33
}
33
34
}
34
35
35
- /// Creates a task when the most recent analysis is older than 30 days.
36
+ /// Creates a task when the most recent analysis is older than
37
+ /// [reanalyzeThreshold] days.
36
38
class AnalyzerDatastoreHistoryTaskSource extends DatastoreHistoryTaskSource {
37
39
final DatastoreDB _db;
38
40
39
41
AnalyzerDatastoreHistoryTaskSource (DatastoreDB db)
40
42
: _db = db,
41
- super (db, afterDays : 30 );
43
+ super (db);
42
44
43
45
@override
44
46
Future <bool > requiresUpdate (String packageName, String packageVersion,
@@ -58,7 +60,7 @@ class AnalyzerDatastoreHistoryTaskSource extends DatastoreHistoryTaskSource {
58
60
59
61
final Duration diff =
60
62
new DateTime .now ().toUtc ().difference (version.analysisTimestamp);
61
- if (diff.inDays >= afterDays ) return true ;
63
+ if (diff >= reanalyzeThreshold ) return true ;
62
64
63
65
if (retryFailed &&
64
66
version.analysisStatus != AnalysisStatus .success &&
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import 'models.dart';
17
17
18
18
final Logger _logger = new Logger ('pub.dartdoc.backend' );
19
19
20
- final Duration _entryUpdateThreshold = const Duration (days: 30 );
20
+ final Duration entryUpdateThreshold = const Duration (days: 90 );
21
21
final Duration _contentDeleteThreshold = const Duration (days: 1 );
22
22
23
23
/// Sets the dartdoc backend.
@@ -95,7 +95,7 @@ class DartdocBackend {
95
95
return true ;
96
96
}
97
97
final age = new DateTime .now ().difference (entry.timestamp).abs ();
98
- if (age > _entryUpdateThreshold ) {
98
+ if (age > entryUpdateThreshold ) {
99
99
return true ;
100
100
}
101
101
return false ;
Original file line number Diff line number Diff line change @@ -25,9 +25,10 @@ class DartdocDatastoreHeadTaskSource extends DatastoreHeadTaskSource {
25
25
}
26
26
}
27
27
28
- /// Creates a task when the most recent dartdoc run is older than 30 days.
28
+ /// Creates a task when the most recent dartdoc run is older than
29
+ /// [entryUpdateThreshold] days.
29
30
class DartdocDatastoreHistoryTaskSource extends DatastoreHistoryTaskSource {
30
- DartdocDatastoreHistoryTaskSource (DatastoreDB db) : super (db, afterDays : 30 );
31
+ DartdocDatastoreHistoryTaskSource (DatastoreDB db) : super (db);
31
32
32
33
@override
33
34
Future <bool > requiresUpdate (String packageName, String packageVersion,
@@ -42,7 +43,7 @@ class DartdocDatastoreHistoryTaskSource extends DatastoreHistoryTaskSource {
42
43
43
44
final now = new DateTime .now ().toUtc ();
44
45
final age = now.difference (entry.timestamp).abs ();
45
- if (age.inDays >= afterDays ) {
46
+ if (age >= entryUpdateThreshold ) {
46
47
return true ;
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -102,15 +102,11 @@ class DatastoreHeadTaskSource implements TaskSource {
102
102
new Task (a.packageName, a.packageVersion, a.timestamp);
103
103
}
104
104
105
- /// Creates a task when the most recent output is older than [afterDays] days .
105
+ /// Creates a task when the most recent output requires an update (e.g. too old) .
106
106
abstract class DatastoreHistoryTaskSource implements TaskSource {
107
107
final DatastoreDB _db;
108
- final int afterDays;
109
108
110
- DatastoreHistoryTaskSource (
111
- this ._db, {
112
- this .afterDays: 30 ,
113
- });
109
+ DatastoreHistoryTaskSource (this ._db);
114
110
115
111
Future <bool > requiresUpdate (String packageName, String packageVersion,
116
112
{bool retryFailed: false });
You can’t perform that action at this time.
0 commit comments