parse-community / Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
http://parseplatform.org
Apache License 2.0
323 stars 260 forks source link

synchronous looping idiom required and/or upsert needed #293

Closed raytrask closed 3 years ago

raytrask commented 6 years ago

I have an app that requires me to iterate a list of results queried from a PC database to feed parse. The results often have to be overridden with new results.

In a legacy java sdk, we simply did:

For each result:

and had no problems.

BTW - our server needs to feed Parse in seconds, not microseconds, though speed would not hurt!

I am new to c# and still trying to grok the async idioms.

I need to synchronize (block) in some way or my processing loop adds in duplicate parse objects for the same results read from database.

Everywhere I look says, "DO NOT BLOCK or you will get deadlocks". And says go async/await all the way, yet when I do that I get duplicates. So I added locks and blocks and I get deadlocks after hours of processing commands just fine.

An upsert may help the find then add or update problem, but it does not solve the duplicate problem when looping.

( I'm considering going with upsert cloud code gist )

Questions: 1) Is there a reason the SDK doesn't support sync and/or upsert out of the box? 2) Is there an idiom I am missing here that loops through a result list without sending duplicates?

This seems like a pretty common use case.

Thanks in advance.

TheFanatr commented 5 years ago

If this is still an issue, could you please provide a code sample? I'm not aware of any issue that would cause object duplication. I think the issue is with your logic here, but I may be misunderstanding your intentions; when you say "for each result", do you mean for each result received from a query operation? Because if so, any query result already "exists" so I don't really understand what you would be finding in your if statement. I can give you some code to tweak that does what you want it to, but I'm having trouble figuring out what your pseudocode means; if you want to give me a more specific example, I can try to help.

TobiasPott commented 4 years ago

@raytrask If this is still an issue to you, would it be possible to get additional information like @TheFanatr requested? We will pick it up as an an internal note on the project board, but we will rely on additional info to reproduce and cope with the problem.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.