@@ -1500,7 +1500,11 @@ protected void fetchAndPutTimerRequest() throws Exception {
15001500 CountDownLatch latch = new CountDownLatch (trs .size ());
15011501 for (TimerRequest req : trs ) {
15021502 req .setLatch (latch );
1503- synchronized (lockWhenFlush ) {
1503+ if (storeConfig .isTimerWheelSnapshotFlush ()) {
1504+ synchronized (lockWhenFlush ) {
1505+ this .putMessageToTimerWheel (req );
1506+ }
1507+ } else {
15041508 this .putMessageToTimerWheel (req );
15051509 }
15061510 }
@@ -1845,17 +1849,20 @@ public void run() {
18451849 long lastSnapshotTime = System .currentTimeMillis ();
18461850
18471851 public void flush () throws IOException {
1848- synchronized ( lockWhenFlush ) {
1849- prepareTimerCheckPoint ();
1850- timerLog . getMappedFileQueue (). flush ( 0 );
1851- if ( storeConfig . isTimerWheelSnapshotFlush ()) {
1852+ if ( storeConfig . isTimerWheelSnapshotFlush () ) {
1853+ synchronized ( lockWhenFlush ) {
1854+ prepareTimerCheckPoint ( );
1855+ timerLog . getMappedFileQueue (). flush ( 0 );
18521856 if (System .currentTimeMillis () - lastSnapshotTime > storeConfig .getTimerWheelSnapshotIntervalMs ()) {
18531857 lastSnapshotTime = System .currentTimeMillis ();
18541858 timerWheel .backup (timerLog .getMappedFileQueue ().getFlushedWhere ());
18551859 }
1856- } else {
1857- timerWheel .flush ();
1860+ timerCheckpoint .flush ();
18581861 }
1862+ } else {
1863+ prepareTimerCheckPoint ();
1864+ timerLog .getMappedFileQueue ().flush (0 );
1865+ timerWheel .flush ();
18591866 timerCheckpoint .flush ();
18601867 }
18611868 if (System .currentTimeMillis () - start > storeConfig .getTimerProgressLogIntervalMs ()) {
0 commit comments