diff options
-rw-r--r-- | config/global.properties.example | 10 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/Globals.java | 5 | ||||
-rw-r--r-- | src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java | 13 |
3 files changed, 21 insertions, 7 deletions
diff --git a/config/global.properties.example b/config/global.properties.example index d4f46a2..238db02 100644 --- a/config/global.properties.example +++ b/config/global.properties.example @@ -65,4 +65,12 @@ ssl_keystore_password=password # how often should the masterserver request a block # from the satellite if the check sum fails # until an error is sent -ssl_socket_transmit_times=20
\ No newline at end of file +ssl_socket_transmit_times=20 + +##################### +# CRC Scheduling # +##################### + +# how often will the crc scheduler check the crc sums of uploading images in seconds +# minimum of 60 s recommended +crc_scheduling_interval=60
\ No newline at end of file diff --git a/src/main/java/org/openslx/imagemaster/Globals.java b/src/main/java/org/openslx/imagemaster/Globals.java index 8d836af..7289760 100644 --- a/src/main/java/org/openslx/imagemaster/Globals.java +++ b/src/main/java/org/openslx/imagemaster/Globals.java @@ -122,6 +122,11 @@ public class Globals { return Util.tryToParseInt( properties.getProperty( "ssl_socket_transmit_times" ) ); } + + public static int getCrcSchedulingInterval() + { + return Util.tryToParseInt( properties.getProperty("crc_scheduling_interval") ); + } /* STRINGS */ diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java b/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java index 73e2f4a..ce89acd 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java @@ -306,16 +306,17 @@ public class ImageProcessor { List<DbImage> list = DbImage.getUploadingImages(); for ( DbImage image : list ) { - String token = image.token; - UploadingImage infos = new UploadingImage( token, image.blockStatus, image.timestamp.getTime(), - image.uuid, image.imagePath ); - ConnectionHandler.addConnection( token, image.imagePath, Connection.UPLOADING ).image = infos; - CRCFile crcFile = new CRCFile( Globals.getImageDir() + "/" + image.uuid + ".crc" ); + UploadingImage infos = new UploadingImage( image.token, image.blockStatus, image.timestamp.getTime(), image.uuid, image.imagePath ); + ConnectionHandler.addConnection( image.token, image.imagePath, Connection.UPLOADING ).image = infos; + CRCFile crcFile = new CRCFile( Globals.getImageDir() + "/" + image.uuid + ".crc" ); // TODO: has to be adjusted with the corresponding value above try { - if ( !crcFile.isValid() ) + if ( !crcFile.isValid() ) { continue; + // UploadingImage object contains an CRCFile = null which invokes the ImageProcessor to retry to save it + } } catch ( IOException e ) { continue; + // same thing here } infos.setCrcFile( crcFile ); uploadingImages.put( image.uuid, infos ); |