taskflushbinlog.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // Copyright (c) 2017-2026, Manticore Software LTD (https://manticoresearch.com)
  3. // Copyright (c) 2001-2016, Andrew Aksyonoff
  4. // Copyright (c) 2008-2016, Sphinx Technologies Inc
  5. // All rights reserved
  6. //
  7. // This program is free software; you can redistribute it and/or modify
  8. // it under the terms of the GNU General Public License. You should have
  9. // received a copy of the GPL license along with this program; if you
  10. // did not, you can find it at http://www.gnu.org/
  11. #include "taskflushbinlog.h"
  12. #include "searchdtask.h"
  13. #include "searchdaemon.h"
  14. #include "binlog.h"
  15. static void ScheduleFlushBinlogNext ()
  16. {
  17. static int iFlushBinlogTask = TaskManager::RegisterGlobal ( "Flush binlog", 1 );
  18. if ( sphInterrupted () )
  19. return;
  20. TaskManager::ScheduleJob ( iFlushBinlogTask, Binlog::NextFlushTimestamp (), []
  21. {
  22. auto pDesc = PublishSystemInfo ( "FLUSH RT BINLOG" );
  23. Binlog::Flush();
  24. ScheduleFlushBinlogNext();
  25. });
  26. }
  27. void StartRtBinlogFlushing ()
  28. {
  29. if ( !Binlog::IsFlushEnabled() )
  30. return;
  31. ScheduleFlushBinlogNext ();
  32. }