#[Solved] Function is Executing Multiple Times For No Reason
1 messages · Page 1 of 1 (latest)
Anyone? From the team
What makes you say no reason? What if you remove that event?
If i Remove that event nothing happens everything works fine. But I am using that event to perform some action.
Sounds like it's triggering off that event then.
Can you log the x-appwrite-event header?
Sure
And are you updating user preferences in the function?
No, I am updating My Preference using Accounts in the Android SDK.
Perhaps it's happening multiple times
override suspend fun setUserPreference(type:String): Result<Boolean, DataError.FetchingError> {
return try {
account.updatePrefs(mapOf("type" to "student"))
Result.Success(true)
} catch (e: AppwriteException) {
when (e.type) {
"general_rate_limit_exceeded" -> Result.Error(DataError.FetchingError.RATE_LIMIT_CROSSED)
"document_not_found" -> Result.Error(DataError.FetchingError.REQUESTED_DOCUMENT_NOT_FOUND)
"Unauthorized" -> Result.Error(DataError.FetchingError.NOT_ACCESS)
else -> Result.Error(DataError.FetchingError.UNKNOWN_SERVER_ERROR)
}
} catch (e: Exception) {
if (e is SocketTimeoutException) {
Result.Error(DataError.FetchingError.TIMEOUT)
} else {
Result.Error(DataError.FetchingError.UNKNOWN_SERVER_ERROR)
}
}
}
This is Where i Am Updating the userPref