Skip to content

Commit

Permalink
feat: add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Angular2Guy committed Jan 12, 2024
1 parent 38396cd commit 6eecfa9
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ public TableService(ImportClient importClient, ImportService importService) {
}

@Async
public void importData() {
public void importData() {
var start = new Date();
//this.importClient.importZipcodes().forEach(myZipcode -> LOGGER.info(myZipcode.toString()));
//this.importClient.importSupermarkets().forEach(mySupermarket -> LOGGER.info(mySupermarket.toString()));
//this.importClient.importProducts().forEach(myProduct -> LOGGER.info(myProduct.toString()));
//this.importClient.importAmazonProducts().forEach(myAmazonProduct -> LOGGER.info(myAmazonProduct.toString()));
LOGGER.info("Import started.");
List<Zipcode> zipcodes = this.importClient.importZipcodes();
List<Supermarket> supermarkets = this.importClient.importSupermarkets();
List<Product> products = this.importClient.importProducts();
List<AmazonProduct> amazonProducts = this.importClient.importAmazonProducts();
LOGGER.info("Data fetched in {}ms", new Date().getTime() - start.getTime());
var deleteStart = new Date();
this.importService.deleteData();
this.importService.saveAllData(zipcodes, supermarkets, products, amazonProducts);
LOGGER.info("Data deleted in {}ms", new Date().getTime() - deleteStart.getTime());
var saveStart = new Date();
this.importService.saveAllData(zipcodes, supermarkets, products, amazonProducts);
LOGGER.info("Data saved in {}ms", new Date().getTime() - saveStart.getTime());
LOGGER.info("Import done in {}ms.", new Date().getTime() - start.getTime());
}
}

0 comments on commit 6eecfa9

Please sign in to comment.