@@ -755,6 +755,18 @@ def setup_authz(projects: list[GithubProject], admins: list[str]) -> util.Authz:
755
755
)
756
756
757
757
758
+ class PeriodicWithStartup (schedulers .Periodic ):
759
+ def __init__ (self , * args : Any , run_on_startup : bool = False , ** kwargs : Any ) -> None :
760
+ super ().__init__ (* args , ** kwargs )
761
+ self .run_on_startup = run_on_startup
762
+
763
+ @defer .inlineCallbacks
764
+ def activate (self ) -> Generator [Any , object , Any ]:
765
+ if self .run_on_startup :
766
+ yield self .setState ("last_build" , None )
767
+ yield super ().activate ()
768
+
769
+
758
770
class NixConfigurator (ConfiguratorBase ):
759
771
"""Janitor is a configurator which create a Janitor Builder with all needed Janitor steps"""
760
772
@@ -841,11 +853,12 @@ def configure(self, config: dict[str, Any]) -> None:
841
853
builderNames = ["reload-github-projects" ],
842
854
buttonName = "Update projects" ,
843
855
),
844
- # project list twice a day
845
- schedulers . Periodic (
856
+ # project list twice a day and on startup
857
+ PeriodicWithStartup (
846
858
name = "reload-github-projects-bidaily" ,
847
859
builderNames = ["reload-github-projects" ],
848
860
periodicBuildTimer = 12 * 60 * 60 ,
861
+ run_on_startup = not self .github .project_cache_file .exists (),
849
862
),
850
863
],
851
864
)
0 commit comments