File tree 2 files changed +5
-11
lines changed
main/java/ru/mystamps/web/service
test/java/ru/mystamps/web/service 2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 39
39
@ Service
40
40
public class CronService {
41
41
42
- public static final int PURGE_UNACTIVATED_REQUEST_AFTER_DAYS = 3 ;
42
+ public static final int PURGE_AFTER_DAYS = 3 ;
43
43
44
- private static final long CHECK_UNACTIVATED_REQUESTS_PERIOD = 12 * DateUtils .MILLIS_PER_HOUR ;
44
+ private static final long CHECK_PERIOD = 12 * DateUtils .MILLIS_PER_HOUR ;
45
45
46
46
private static final Logger LOG = LoggerFactory .getLogger (CronService .class );
47
47
48
48
@ Inject
49
49
private UsersActivationDao usersActivationDao ;
50
50
51
- @ Scheduled (fixedDelay = CHECK_UNACTIVATED_REQUESTS_PERIOD )
51
+ @ Scheduled (fixedDelay = CHECK_PERIOD )
52
52
@ Transactional
53
53
public void purgeUsersActivations () {
54
- final Date expiredSince = DateUtils .addDays (
55
- new Date (),
56
- -PURGE_UNACTIVATED_REQUEST_AFTER_DAYS
57
- );
54
+ final Date expiredSince = DateUtils .addDays (new Date (), -PURGE_AFTER_DAYS );
58
55
59
56
final List <UsersActivation > expiredActivations =
60
57
usersActivationDao .findByCreatedAtLessThan (expiredSince );
Original file line number Diff line number Diff line change @@ -86,10 +86,7 @@ public void purgeUsersActivationsShouldPassExpiredDateToDao() {
86
86
87
87
final Calendar calendar = new GregorianCalendar ();
88
88
calendar .setTime (new Date ());
89
- calendar .add (
90
- Calendar .DAY_OF_MONTH ,
91
- -(CronService .PURGE_UNACTIVATED_REQUEST_AFTER_DAYS )
92
- );
89
+ calendar .add (Calendar .DAY_OF_MONTH , -(CronService .PURGE_AFTER_DAYS ));
93
90
94
91
// Truncate seconds in dates to prevent test fail due to different milliseconds in dates
95
92
final Date expectedDate = DateUtils .truncate (calendar .getTime (), Calendar .SECOND );
You can’t perform that action at this time.
0 commit comments