Snap: Try to delete incomplete uploads when starting.

Thanks to xet7 !

Related: #1298
This commit is contained in:
Lauri Ojansivu 2022-04-03 00:01:12 +03:00
parent c8f4fe3da5
commit 25dc378c46

View file

@ -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