2
0
Эх сурвалжийг харах

Snap: Try to delete incomplete uploads when starting.

Thanks to xet7 !

Related: #1298
Lauri Ojansivu 3 жил өмнө
parent
commit
25dc378c46

+ 4 - 0
snap-src/bin/mongodb-control

@@ -75,6 +75,8 @@ if [ -z "$MONGO_URL" ]; then
     # Drop indexes on database upgrade, when starting MongoDB
     #mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
     mongo wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });' $BIND_OPTIONS
+    # Delete incomplete uploads so that they would not prevent starting WeKan
+    mongo wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS
 
 else
 
@@ -96,5 +98,7 @@ else
     # Drop indexes on database upgrade, when starting MongoDB
     #mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
     mongo wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.2" });' $BIND_OPTIONS
+   # Delete incomplete uploads so that they would not prevent starting WeKan
+    mongo wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS
 
 fi