add a little sleep in order to understand if it solve the issue 21980
This commit is contained in:
parent
77048b747e
commit
ea22672588
|
@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.DuplicateKeyException;
|
||||
import com.mongodb.gridfs.GridFSDBFile;
|
||||
|
||||
/**
|
||||
|
@ -225,8 +226,20 @@ public class SoftCopyOperator extends SoftCopy {
|
|||
document.put("length", sourceObject.getLength());
|
||||
// set chunkSize inherited from original object
|
||||
document.put("chunkSize", sourceObject.getChunkSize());
|
||||
metaCollectionInstance.insert(document);
|
||||
metaCollectionInstance.save(document);
|
||||
try {
|
||||
metaCollectionInstance.insert(document);
|
||||
metaCollectionInstance.save(document);
|
||||
}catch (DuplicateKeyException e) {
|
||||
logger.warn("key already present or not completely removed. Wait few seconds and retry");
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
metaCollectionInstance.insert(document);
|
||||
metaCollectionInstance.save(document);
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue