File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
src/main/java/app/betterhm/backend Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 22
33import org .springframework .boot .SpringApplication ;
44import org .springframework .boot .autoconfigure .SpringBootApplication ;
5+ import org .springframework .scheduling .annotation .EnableScheduling ;
56
67@ SpringBootApplication
8+ @ EnableScheduling
79public class BackendApplication {
810
911 public static void main (String [] args ) {
Original file line number Diff line number Diff line change @@ -29,10 +29,11 @@ public StaticUpdater(YamlParser yamlParser) {
2929 * Downloads the calendar files from the source URLs and saves them in the static folder
3030 */
3131 @ PostConstruct
32- @ Scheduled (cron = "0 4 * * *" )
32+ @ Scheduled (cron = "0 0 4 * * *" )
3333 public void updateCalendar (){
3434 yaml .Calendars ().stream ().filter (element -> element .SourceURL ().isPresent ()).forEach (element ->
3535 downloadFile (element .SourceURL ().get (), "src/main/resources/static/calendar/" + element .ID () + ".ics" ));
36+ logger .info ("Calendar files updated" );
3637 }
3738
3839 /**
@@ -42,9 +43,11 @@ public void updateCalendar(){
4243 */
4344 private void downloadFile (String url , String path ) {
4445 URL website ;
46+
4547 try {
4648 website = new URL (url );
4749 } catch (MalformedURLException e ) {
50+ logger .error ("Invalid URL" , e );
4851 throw new RuntimeException ("Invalid URL" , e );
4952 }
5053 try (InputStream in = website .openStream ()) {
Original file line number Diff line number Diff line change @@ -56,11 +56,12 @@ public CapacityApiElement getSingleCapacityElement(String enum_nameToFind){
5656 /**
5757 * Method to update the Capacity Elements every 5 Minutes
5858 */
59- @ Scheduled (cron = "0/5 * * * * *" )
59+ @ Scheduled (cron = "0 */5 * * * *" )
6060 public void updateCapacity (){
6161 List <CapacityApiElement > newElementList = new ArrayList <>();
6262 capacityConfigRecordList .forEach (Element -> newElementList .add (getUpdatedCapacityElement (Element )));
6363 capacityApiElementList = newElementList ;
64+ logger .info ("Capacity Elements Updated" );
6465 }
6566
6667 private CapacityApiElement getUpdatedCapacityElement (CapacityConfigRecord capacityConfigRecord ){
You can’t perform that action at this time.
0 commit comments