Exemple #1
0
func init() {
	revel.OnAppStart(func() {
		// Fix don't run on weekends
		thumbnailServerUrl, _ := revel.Config.String("thumbnail_server")
		directory, _ := revel.Config.String("root_dir")
		revel.ERROR.Printf("The directory is %s", directory)
		jobs.Schedule("@midnight", photoJobs.GenerateThumbnails{Server: thumbnailServerUrl,
			Directory: directory,
			Duration:  10800})
	})

	// Filters is the default set of global filters.
	revel.Filters = []revel.Filter{
		revel.PanicFilter,             // Recover from panics and display an error page instead.
		revel.RouterFilter,            // Use the routing table to select the right Action
		revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
		revel.ParamsFilter,            // Parse parameters into Controller.Params.
		revel.SessionFilter,           // Restore and write the session cookie.
		revel.FlashFilter,             // Restore and write the flash cookie.
		revel.ValidationFilter,        // Restore kept validation errors and save new ones from cookie.
		revel.I18nFilter,              // Resolve the requested language
		revel.InterceptorFilter,       // Run interceptors around the action.
		revel.ActionInvoker,           // Invoke the action.
	}
}
Exemple #2
0
Fichier : init.go Projet : jsli/ota
func init() {
	// Filters is the default set of global filters.
	revel.Filters = []revel.Filter{
		revel.PanicFilter,             // Recover from panics and display an error page instead.
		revel.RouterFilter,            // Use the routing table to select the right Action
		revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
		revel.ParamsFilter,            // Parse parameters into Controller.Params.
		revel.SessionFilter,           // Restore and write the session cookie.
		revel.FlashFilter,             // Restore and write the flash cookie.
		revel.ValidationFilter,        // Restore kept validation errors and save new ones from cookie.
		revel.I18nFilter,              // Resolve the requested language
		revel.InterceptorFilter,       // Run interceptors around the action.
		revel.ActionInvoker,           // Invoke the action.
	}

	revel.OnAppStart(func() {
		createion_job := ota_job.ReleaseCreationJob{}
		jobs.Schedule("@every 15s", &createion_job)

		remove_job := ota_job.ReleaseRemoveJob{}
		jobs.Schedule("@every 60s", &remove_job)
	})
}
Exemple #3
0
func init() {
	revel.OnAppStart(func() {
		jobs.Schedule("cron.update_cache", UpdateCache{})
		jobs.In(5*time.Second, UpdateCache{})
	})
}
Exemple #4
0
func init() {
	revel.OnAppStart(func() {
		jobs.Schedule("@every 1m", BookingCounter{})
	})
}