Update PR

* Reinstate variable cleanup post testing
This commit is contained in:
abraunegg 2024-04-27 12:51:40 +10:00
parent 654d2b4fc5
commit 39c04642cd
4 changed files with 105 additions and 103 deletions

View file

@ -15,8 +15,6 @@ import std.range;
import log; import log;
import util; import util;
__gshared CurlEngine[] curlEnginePool;
class CurlResponse { class CurlResponse {
HTTP.Method method; HTTP.Method method;
const(char)[] url; const(char)[] url;
@ -163,6 +161,8 @@ class CurlResponse {
class CurlEngine { class CurlEngine {
__gshared CurlEngine[] curlEnginePool;
HTTP http; HTTP http;
bool keepAlive; bool keepAlive;
ulong dnsTimeout; ulong dnsTimeout;
@ -179,6 +179,7 @@ class CurlEngine {
~this() { ~this() {
// The destructor should only clean up resources owned directly by this instance // The destructor should only clean up resources owned directly by this instance
addLogEntry("CurlEngine DESTRUCTOR CALLED", ["debug"]); addLogEntry("CurlEngine DESTRUCTOR CALLED", ["debug"]);
addLogEntry("CurlEngine DESTRUCTOR CALLED");
// Avoid modifying or destroying shared/static resources here // Avoid modifying or destroying shared/static resources here
if (uploadFile.isOpen()) { if (uploadFile.isOpen()) {
@ -252,7 +253,6 @@ class CurlEngine {
// Destroy all curl instances // Destroy all curl instances
static void destroyAllCurlInstances() { static void destroyAllCurlInstances() {
addLogEntry("DESTROY ALL CURL ENGINES", ["debug"]); addLogEntry("DESTROY ALL CURL ENGINES", ["debug"]);
// Release all 'curl' instances // Release all 'curl' instances
releaseAllCurlInstances(); releaseAllCurlInstances();

View file

@ -435,8 +435,8 @@ int main(string[] cliArgs) {
// Flag that we were able to initalise the API in the application config // Flag that we were able to initalise the API in the application config
oneDriveApiInstance.debugOutputConfiguredAPIItems(); oneDriveApiInstance.debugOutputConfiguredAPIItems();
oneDriveApiInstance.releaseCurlEngine(); oneDriveApiInstance.releaseCurlEngine();
object.destroy(oneDriveApiInstance);
//object.destroy(oneDriveApiInstance); oneDriveApiInstance = null;
// Need to configure the itemDB and syncEngineInstance for 'sync' and 'non-sync' operations // Need to configure the itemDB and syncEngineInstance for 'sync' and 'non-sync' operations
addLogEntry("Opening the item database ...", ["verbose"]); addLogEntry("Opening the item database ...", ["verbose"]);

View file

@ -485,8 +485,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getDefaultDriveApiInstance.releaseCurlEngine(); getDefaultDriveApiInstance.releaseCurlEngine();
//object.destroy(getDefaultDriveApiInstance); object.destroy(getDefaultDriveApiInstance);
//getDefaultDriveApiInstance = null; getDefaultDriveApiInstance = null;
} }
// Get Default Root Details for this Account // Get Default Root Details for this Account
@ -534,8 +534,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getDefaultRootApiInstance.releaseCurlEngine(); getDefaultRootApiInstance.releaseCurlEngine();
//object.destroy(getDefaultRootApiInstance); object.destroy(getDefaultRootApiInstance);
//getDefaultRootApiInstance = null; getDefaultRootApiInstance = null;
} }
// Reset syncFailures to false based on file activity // Reset syncFailures to false based on file activity
@ -947,8 +947,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getDeltaQueryOneDriveApiInstance.releaseCurlEngine(); getDeltaQueryOneDriveApiInstance.releaseCurlEngine();
//object.destroy(getDeltaQueryOneDriveApiInstance); object.destroy(getDeltaQueryOneDriveApiInstance);
//getDeltaQueryOneDriveApiInstance = null; getDeltaQueryOneDriveApiInstance = null;
// Log that we have finished querying the /delta API // Log that we have finished querying the /delta API
if (appConfig.verbosityCount == 0) { if (appConfig.verbosityCount == 0) {
@ -2251,8 +2251,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
downloadFileOneDriveApiInstance.releaseCurlEngine(); downloadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(downloadFileOneDriveApiInstance); object.destroy(downloadFileOneDriveApiInstance);
//downloadFileOneDriveApiInstance = null; downloadFileOneDriveApiInstance = null;
} catch (OneDriveException exception) { } catch (OneDriveException exception) {
addLogEntry("downloadFileOneDriveApiInstance.downloadById(downloadDriveId, downloadItemId, newItemPath, jsonFileSize); generated a OneDriveException", ["debug"]); addLogEntry("downloadFileOneDriveApiInstance.downloadById(downloadDriveId, downloadItemId, newItemPath, jsonFileSize); generated a OneDriveException", ["debug"]);
@ -2732,8 +2732,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadLastModifiedTimeApiInstance.releaseCurlEngine(); uploadLastModifiedTimeApiInstance.releaseCurlEngine();
//object.destroy(uploadLastModifiedTimeApiInstance); object.destroy(uploadLastModifiedTimeApiInstance);
//uploadLastModifiedTimeApiInstance = null; uploadLastModifiedTimeApiInstance = null;
// Do we actually save the response? // Do we actually save the response?
// Special case here .. if the DB record item (originItem) is a remote object, thus, if we save the 'response' we will have a DB FOREIGN KEY constraint failed problem // Special case here .. if the DB record item (originItem) is a remote object, thus, if we save the 'response' we will have a DB FOREIGN KEY constraint failed problem
@ -2768,8 +2768,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadLastModifiedTimeApiInstance.releaseCurlEngine(); uploadLastModifiedTimeApiInstance.releaseCurlEngine();
//object.destroy(uploadLastModifiedTimeApiInstance); object.destroy(uploadLastModifiedTimeApiInstance);
//uploadLastModifiedTimeApiInstance = null; uploadLastModifiedTimeApiInstance = null;
} }
} }
@ -3995,8 +3995,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadFileOneDriveApiInstance.releaseCurlEngine(); uploadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadFileOneDriveApiInstance); object.destroy(uploadFileOneDriveApiInstance);
//uploadFileOneDriveApiInstance = null; uploadFileOneDriveApiInstance = null;
// Return JSON // Return JSON
return uploadResponse; return uploadResponse;
@ -4028,8 +4028,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getCurrentDriveQuotaApiInstance.releaseCurlEngine(); getCurrentDriveQuotaApiInstance.releaseCurlEngine();
//object.destroy(getCurrentDriveQuotaApiInstance); object.destroy(getCurrentDriveQuotaApiInstance);
//getCurrentDriveQuotaApiInstance = null; getCurrentDriveQuotaApiInstance = null;
} catch (OneDriveException e) { } catch (OneDriveException e) {
addLogEntry("currentDriveQuota = onedrive.getDriveQuota(driveId) generated a OneDriveException", ["debug"]); addLogEntry("currentDriveQuota = onedrive.getDriveQuota(driveId) generated a OneDriveException", ["debug"]);
@ -4785,8 +4785,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine(); createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine();
//object.destroy(createDirectoryOnlineOneDriveApiInstance); object.destroy(createDirectoryOnlineOneDriveApiInstance);
//createDirectoryOnlineOneDriveApiInstance = null; createDirectoryOnlineOneDriveApiInstance = null;
return; return;
} else { } else {
@ -4811,8 +4811,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine(); createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine();
//object.destroy(createDirectoryOnlineOneDriveApiInstance); object.destroy(createDirectoryOnlineOneDriveApiInstance);
//createDirectoryOnlineOneDriveApiInstance = null; createDirectoryOnlineOneDriveApiInstance = null;
return; return;
} else { } else {
@ -4827,8 +4827,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine(); createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine();
//object.destroy(createDirectoryOnlineOneDriveApiInstance); object.destroy(createDirectoryOnlineOneDriveApiInstance);
//createDirectoryOnlineOneDriveApiInstance = null; createDirectoryOnlineOneDriveApiInstance = null;
return; return;
} }
@ -4839,8 +4839,8 @@ class SyncEngine {
addLogEntry("Skipping: " ~ buildNormalizedPath(absolutePath(thisNewPathToCreate))); addLogEntry("Skipping: " ~ buildNormalizedPath(absolutePath(thisNewPathToCreate)));
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine(); createDirectoryOnlineOneDriveApiInstance.releaseCurlEngine();
//object.destroy(createDirectoryOnlineOneDriveApiInstance); object.destroy(createDirectoryOnlineOneDriveApiInstance);
//createDirectoryOnlineOneDriveApiInstance = null; createDirectoryOnlineOneDriveApiInstance = null;
return; return;
} }
@ -5062,8 +5062,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
checkFileOneDriveApiInstance.releaseCurlEngine(); checkFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(checkFileOneDriveApiInstance); object.destroy(checkFileOneDriveApiInstance);
//checkFileOneDriveApiInstance = null; checkFileOneDriveApiInstance = null;
// Portable Operating System Interface (POSIX) testing of JSON response from OneDrive API // Portable Operating System Interface (POSIX) testing of JSON response from OneDrive API
if (hasName(fileDetailsFromOneDrive)) { if (hasName(fileDetailsFromOneDrive)) {
@ -5128,8 +5128,8 @@ class SyncEngine {
} catch (OneDriveException exception) { } catch (OneDriveException exception) {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
checkFileOneDriveApiInstance.releaseCurlEngine(); checkFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(checkFileOneDriveApiInstance); object.destroy(checkFileOneDriveApiInstance);
//checkFileOneDriveApiInstance = null; checkFileOneDriveApiInstance = null;
// If we get a 404 .. the file is not online .. this is what we want .. file does not exist online // If we get a 404 .. the file is not online .. this is what we want .. file does not exist online
if (exception.httpStatusCode == 404) { if (exception.httpStatusCode == 404) {
@ -5147,8 +5147,8 @@ class SyncEngine {
} catch (posixException e) { } catch (posixException e) {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
checkFileOneDriveApiInstance.releaseCurlEngine(); checkFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(checkFileOneDriveApiInstance); object.destroy(checkFileOneDriveApiInstance);
//checkFileOneDriveApiInstance = null; checkFileOneDriveApiInstance = null;
// Display POSIX error message // Display POSIX error message
displayPosixErrorMessage(e.msg); displayPosixErrorMessage(e.msg);
@ -5156,8 +5156,8 @@ class SyncEngine {
} catch (jsonResponseException e) { } catch (jsonResponseException e) {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
checkFileOneDriveApiInstance.releaseCurlEngine(); checkFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(checkFileOneDriveApiInstance); object.destroy(checkFileOneDriveApiInstance);
//checkFileOneDriveApiInstance = null; checkFileOneDriveApiInstance = null;
// Display JSON error message // Display JSON error message
addLogEntry(e.msg, ["debug"]); addLogEntry(e.msg, ["debug"]);
@ -5246,8 +5246,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadFileOneDriveApiInstance.releaseCurlEngine(); uploadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadFileOneDriveApiInstance); object.destroy(uploadFileOneDriveApiInstance);
//uploadFileOneDriveApiInstance = null; uploadFileOneDriveApiInstance = null;
} catch (OneDriveException exception) { } catch (OneDriveException exception) {
// An error was responded with - what was it // An error was responded with - what was it
@ -5261,8 +5261,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadFileOneDriveApiInstance.releaseCurlEngine(); uploadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadFileOneDriveApiInstance); object.destroy(uploadFileOneDriveApiInstance);
//uploadFileOneDriveApiInstance = null; uploadFileOneDriveApiInstance = null;
} catch (FileException e) { } catch (FileException e) {
// display the error message // display the error message
@ -5271,8 +5271,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadFileOneDriveApiInstance.releaseCurlEngine(); uploadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadFileOneDriveApiInstance); object.destroy(uploadFileOneDriveApiInstance);
//uploadFileOneDriveApiInstance = null; uploadFileOneDriveApiInstance = null;
} }
} else { } else {
// Initialise API for session upload // Initialise API for session upload
@ -5363,8 +5363,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadFileOneDriveApiInstance.releaseCurlEngine(); uploadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadFileOneDriveApiInstance); object.destroy(uploadFileOneDriveApiInstance);
//uploadFileOneDriveApiInstance = null; uploadFileOneDriveApiInstance = null;
} }
} else { } else {
// We are in a --dry-run scenario // We are in a --dry-run scenario
@ -5690,8 +5690,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadDeletedItemOneDriveApiInstance.releaseCurlEngine(); uploadDeletedItemOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadDeletedItemOneDriveApiInstance); object.destroy(uploadDeletedItemOneDriveApiInstance);
//uploadDeletedItemOneDriveApiInstance = null; uploadDeletedItemOneDriveApiInstance = null;
} catch (OneDriveException e) { } catch (OneDriveException e) {
if (e.httpStatusCode == 404) { if (e.httpStatusCode == 404) {
@ -5701,8 +5701,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadDeletedItemOneDriveApiInstance.releaseCurlEngine(); uploadDeletedItemOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadDeletedItemOneDriveApiInstance); object.destroy(uploadDeletedItemOneDriveApiInstance);
//uploadDeletedItemOneDriveApiInstance = null; uploadDeletedItemOneDriveApiInstance = null;
} }
// Delete the reference in the local database // Delete the reference in the local database
@ -5764,8 +5764,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
performReverseDeletionOneDriveApiInstance.releaseCurlEngine(); performReverseDeletionOneDriveApiInstance.releaseCurlEngine();
//object.destroy(performReverseDeletionOneDriveApiInstance); object.destroy(performReverseDeletionOneDriveApiInstance);
//performReverseDeletionOneDriveApiInstance = null; performReverseDeletionOneDriveApiInstance = null;
} }
// Create a fake OneDrive response suitable for use with saveItem // Create a fake OneDrive response suitable for use with saveItem
@ -6098,8 +6098,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
generateDeltaResponseOneDriveApiInstance.releaseCurlEngine(); generateDeltaResponseOneDriveApiInstance.releaseCurlEngine();
//object.destroy(generateDeltaResponseOneDriveApiInstance); object.destroy(generateDeltaResponseOneDriveApiInstance);
//generateDeltaResponseOneDriveApiInstance = null; generateDeltaResponseOneDriveApiInstance = null;
// Must force exit here, allow logging to be done // Must force exit here, allow logging to be done
forceExit(); forceExit();
@ -6268,8 +6268,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
generateDeltaResponseOneDriveApiInstance.releaseCurlEngine(); generateDeltaResponseOneDriveApiInstance.releaseCurlEngine();
//object.destroy(generateDeltaResponseOneDriveApiInstance); object.destroy(generateDeltaResponseOneDriveApiInstance);
//generateDeltaResponseOneDriveApiInstance = null; generateDeltaResponseOneDriveApiInstance = null;
// Return the generated JSON response // Return the generated JSON response
return selfGeneratedDeltaResponse; return selfGeneratedDeltaResponse;
@ -6362,8 +6362,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
queryChildrenOneDriveApiInstance.releaseCurlEngine(); queryChildrenOneDriveApiInstance.releaseCurlEngine();
//object.destroy(queryChildrenOneDriveApiInstance); object.destroy(queryChildrenOneDriveApiInstance);
//queryChildrenOneDriveApiInstance = null; queryChildrenOneDriveApiInstance = null;
// return response // return response
return thisLevelChildrenData; return thisLevelChildrenData;
@ -6628,8 +6628,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
queryOneDriveForSpecificPath.releaseCurlEngine(); queryOneDriveForSpecificPath.releaseCurlEngine();
//object.destroy(queryOneDriveForSpecificPath); object.destroy(queryOneDriveForSpecificPath);
//queryOneDriveForSpecificPath = null; queryOneDriveForSpecificPath = null;
// Output our search results // Output our search results
addLogEntry("queryOneDriveForSpecificPathAndCreateIfMissing.getPathDetailsAPIResponse = " ~ to!string(getPathDetailsAPIResponse), ["debug"]); addLogEntry("queryOneDriveForSpecificPathAndCreateIfMissing.getPathDetailsAPIResponse = " ~ to!string(getPathDetailsAPIResponse), ["debug"]);
@ -6835,8 +6835,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
movePathOnlineApiInstance.releaseCurlEngine(); movePathOnlineApiInstance.releaseCurlEngine();
//object.destroy(movePathOnlineApiInstance); object.destroy(movePathOnlineApiInstance);
//movePathOnlineApiInstance = null; movePathOnlineApiInstance = null;
// save the move response from OneDrive in the database // save the move response from OneDrive in the database
// Is the response a valid JSON object - validation checking done in saveItem // Is the response a valid JSON object - validation checking done in saveItem
@ -6949,8 +6949,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
return; return;
} }
@ -6969,8 +6969,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
return; return;
} }
@ -6982,8 +6982,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
return; return;
} }
@ -7013,8 +7013,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
return; return;
} }
@ -7041,8 +7041,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
return; return;
} }
@ -7096,8 +7096,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
return; return;
} }
@ -7130,8 +7130,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
querySharePointLibraryNameApiInstance.releaseCurlEngine(); querySharePointLibraryNameApiInstance.releaseCurlEngine();
//object.destroy(querySharePointLibraryNameApiInstance); object.destroy(querySharePointLibraryNameApiInstance);
//querySharePointLibraryNameApiInstance = null; querySharePointLibraryNameApiInstance = null;
} }
// Query the sync status of the client and the local system // Query the sync status of the client and the local system
@ -7242,8 +7242,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getDeltaQueryOneDriveApiInstance.releaseCurlEngine(); getDeltaQueryOneDriveApiInstance.releaseCurlEngine();
//object.destroy(getDeltaQueryOneDriveApiInstance); object.destroy(getDeltaQueryOneDriveApiInstance);
//getDeltaQueryOneDriveApiInstance = null; getDeltaQueryOneDriveApiInstance = null;
// Needed after printing out '....' when fetching changes from OneDrive API // Needed after printing out '....' when fetching changes from OneDrive API
if (appConfig.verbosityCount == 0) if (appConfig.verbosityCount == 0)
@ -7347,8 +7347,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
queryOneDriveForFileDetailsApiInstance.releaseCurlEngine(); queryOneDriveForFileDetailsApiInstance.releaseCurlEngine();
//object.destroy(queryOneDriveForFileDetailsApiInstance); object.destroy(queryOneDriveForFileDetailsApiInstance);
//queryOneDriveForFileDetailsApiInstance = null; queryOneDriveForFileDetailsApiInstance = null;
return; return;
} }
@ -7431,8 +7431,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
queryOneDriveForFileDetailsApiInstance.releaseCurlEngine(); queryOneDriveForFileDetailsApiInstance.releaseCurlEngine();
//object.destroy(queryOneDriveForFileDetailsApiInstance); object.destroy(queryOneDriveForFileDetailsApiInstance);
//queryOneDriveForFileDetailsApiInstance = null; queryOneDriveForFileDetailsApiInstance = null;
} }
} }
@ -7469,15 +7469,15 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getCurrentDriveQuotaApiInstance.releaseCurlEngine(); getCurrentDriveQuotaApiInstance.releaseCurlEngine();
//object.destroy(getCurrentDriveQuotaApiInstance); object.destroy(getCurrentDriveQuotaApiInstance);
//getCurrentDriveQuotaApiInstance = null; getCurrentDriveQuotaApiInstance = null;
} catch (OneDriveException e) { } catch (OneDriveException e) {
addLogEntry("currentDriveQuota = onedrive.getDriveQuota(driveId) generated a OneDriveException", ["debug"]); addLogEntry("currentDriveQuota = onedrive.getDriveQuota(driveId) generated a OneDriveException", ["debug"]);
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
getCurrentDriveQuotaApiInstance.releaseCurlEngine(); getCurrentDriveQuotaApiInstance.releaseCurlEngine();
//object.destroy(getCurrentDriveQuotaApiInstance); object.destroy(getCurrentDriveQuotaApiInstance);
//getCurrentDriveQuotaApiInstance = null; getCurrentDriveQuotaApiInstance = null;
} }
// validate that currentDriveQuota is a JSON value // validate that currentDriveQuota is a JSON value
@ -7667,8 +7667,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
validateUploadSessionFileDataApiInstance.releaseCurlEngine(); validateUploadSessionFileDataApiInstance.releaseCurlEngine();
//object.destroy(validateUploadSessionFileDataApiInstance); object.destroy(validateUploadSessionFileDataApiInstance);
//validateUploadSessionFileDataApiInstance = null; validateUploadSessionFileDataApiInstance = null;
} catch (OneDriveException e) { } catch (OneDriveException e) {
// handle any onedrive error response as invalid // handle any onedrive error response as invalid
@ -7676,8 +7676,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
validateUploadSessionFileDataApiInstance.releaseCurlEngine(); validateUploadSessionFileDataApiInstance.releaseCurlEngine();
//object.destroy(validateUploadSessionFileDataApiInstance); object.destroy(validateUploadSessionFileDataApiInstance);
//validateUploadSessionFileDataApiInstance = null; validateUploadSessionFileDataApiInstance = null;
return false; return false;
} }
@ -7742,8 +7742,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
uploadFileOneDriveApiInstance.releaseCurlEngine(); uploadFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(uploadFileOneDriveApiInstance); object.destroy(uploadFileOneDriveApiInstance);
//uploadFileOneDriveApiInstance = null; uploadFileOneDriveApiInstance = null;
// Was the response from the OneDrive API a valid JSON item? // Was the response from the OneDrive API a valid JSON item?
if (uploadResponse.type() == JSONType.object) { if (uploadResponse.type() == JSONType.object) {
@ -7871,8 +7871,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
checkFileOneDriveApiInstance.releaseCurlEngine(); checkFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(checkFileOneDriveApiInstance); object.destroy(checkFileOneDriveApiInstance);
//checkFileOneDriveApiInstance = null; checkFileOneDriveApiInstance = null;
// Return child // Return child
return child; return child;
@ -7890,8 +7890,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
checkFileOneDriveApiInstance.releaseCurlEngine(); checkFileOneDriveApiInstance.releaseCurlEngine();
//object.destroy(checkFileOneDriveApiInstance); object.destroy(checkFileOneDriveApiInstance);
//checkFileOneDriveApiInstance = null; checkFileOneDriveApiInstance = null;
// return an empty JSON item // return an empty JSON item
return onedriveJSONItem; return onedriveJSONItem;
@ -8020,8 +8020,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
sharedWithMeOneDriveApiInstance.releaseCurlEngine(); sharedWithMeOneDriveApiInstance.releaseCurlEngine();
//object.destroy(sharedWithMeOneDriveApiInstance); object.destroy(sharedWithMeOneDriveApiInstance);
//sharedWithMeOneDriveApiInstance = null; sharedWithMeOneDriveApiInstance = null;
} catch (OneDriveException e) { } catch (OneDriveException e) {
// Display error message // Display error message
@ -8029,8 +8029,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
sharedWithMeOneDriveApiInstance.releaseCurlEngine(); sharedWithMeOneDriveApiInstance.releaseCurlEngine();
//object.destroy(sharedWithMeOneDriveApiInstance); object.destroy(sharedWithMeOneDriveApiInstance);
//sharedWithMeOneDriveApiInstance = null; sharedWithMeOneDriveApiInstance = null;
return; return;
} }
@ -8124,8 +8124,8 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
sharedWithMeOneDriveApiInstance.releaseCurlEngine(); sharedWithMeOneDriveApiInstance.releaseCurlEngine();
//object.destroy(sharedWithMeOneDriveApiInstance); object.destroy(sharedWithMeOneDriveApiInstance);
//sharedWithMeOneDriveApiInstance = null; sharedWithMeOneDriveApiInstance = null;
return; return;
} }
@ -8330,7 +8330,7 @@ class SyncEngine {
// OneDrive API Instance Cleanup - Shutdown API, free curl object and memory // OneDrive API Instance Cleanup - Shutdown API, free curl object and memory
sharedWithMeOneDriveApiInstance.releaseCurlEngine(); sharedWithMeOneDriveApiInstance.releaseCurlEngine();
//object.destroy(sharedWithMeOneDriveApiInstance); object.destroy(sharedWithMeOneDriveApiInstance);
//sharedWithMeOneDriveApiInstance = null; sharedWithMeOneDriveApiInstance = null;
} }
} }

View file

@ -80,6 +80,8 @@ class OneDriveWebhook {
} }
// Release API instance back to the pool // Release API instance back to the pool
oneDriveApiInstance.releaseCurlEngine(); oneDriveApiInstance.releaseCurlEngine();
object.destroy(oneDriveApiInstance);
oneDriveApiInstance = null;
} }
private static void handle(shared OneDriveWebhook _this, Cgi cgi) { private static void handle(shared OneDriveWebhook _this, Cgi cgi) {