Changeset 542d17a


Ignore:
Timestamp:
01/09/12 16:53:57 (4 months ago)
Author:
Micke Prag <micke.prag@…>
Branches:
('master', 'deebf2045e7119c339412580f37a1e653f7d5715')('controller-upgrade', '00f95d22e12d96ef089e0902ef62ae8ce841dc6f')
Children:
fb8e978accbe51e1a0923cb57edfd03c8ca531ca
Parents:
988b44381031a74e5e5d9abf406265117e81a636
git-author:
Micke Prag <micke.prag@telldus.se>2012-01-09 16:53:09+01:00
git-committer:
Micke Prag <micke.prag@telldus.se>2012-01-09 16:53:57+01:00
Message:

Add janitor object for regular maintenance and cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • telldus-core/service/TelldusMain.cpp

    rcccaf8 r542d17a  
    77#include "ControllerListener.h" 
    88#include "EventUpdateManager.h" 
     9#include "Timer.h" 
     10#include "Log.h" 
    911 
    1012#include <stdio.h> 
     
    4042        EventRef clientEvent = d->eventHandler.addEvent(); 
    4143        EventRef dataEvent = d->eventHandler.addEvent(); 
     44        EventRef janitor = d->eventHandler.addEvent(); //Used for regular cleanups 
     45        Timer supervisor(janitor); //Tells the janitor to go back to work 
     46        supervisor.setInterval(60*5); //Every 5 minutes 
     47        supervisor.start(); 
    4248 
    4349        ControllerManager controllerManager(dataEvent.get()); 
     
    102108                        } 
    103109                } 
     110                if (janitor->isSignaled()) { 
     111                        //Clear all of them if there is more than one 
     112                        while(janitor->isSignaled()) { 
     113                                janitor->popSignal(); 
     114                        } 
     115                        Log::debug("Do Janitor cleanup"); 
     116                } 
    104117        } 
     118 
     119        supervisor.stop(); 
    105120} 
    106121 
Note: See TracChangeset for help on using the changeset viewer.