I made a form with which a user can grade something, fill out some details and submit. Then contour sends a confirmation email with link containing a unique code. When the user clicks the link he is send to a page with a usercontrol that validates the code, checks if the email address has not been submitted yet and, if everything's cool, approves the record.
Now, after almost a thousand votes the validationpage takes ages to complete. I'm wondering if i went about this the right way. The usercontrol loops through all records and checks if the record is not approved yet and if the emailaddress matches the submitted emailaddress. It is very possible that my code is far from optimal (just started developing in .Net) but is this the right way of doing it? Maby i should move the email check to the votingpage, like in a custom fieldtype. But then i would still need to loop through all records..
I would very much like to see some decent sample code for looping approved records and checking the email address. (I'm not using linq, should i?)
Sorry to bump this but i am still looking for a way to loop and check a couple thousand contour records the right way. Is GetAllRecords the right method for this? I can't specify a pageId because voting takes place on different pages.
I know this is a couple of years after the party, but did you ever find a quicker way of looping through the records?
I'm finding myself in need of looping through 50k+ records. I'm only needing to do it once every now and then as I'm using Lucene to index the results for lightning fast searching, but to rebuild the index is stupidly slow.. It's hammerring SQL..
Voting with email check. Best way to do this.
Hey guys,
First some backgroundinfo.
I made a form with which a user can grade something, fill out some details and submit. Then contour sends a confirmation email with link containing a unique code. When the user clicks the link he is send to a page with a usercontrol that validates the code, checks if the email address has not been submitted yet and, if everything's cool, approves the record.
Now, after almost a thousand votes the validationpage takes ages to complete. I'm wondering if i went about this the right way. The usercontrol loops through all records and checks if the record is not approved yet and if the emailaddress matches the submitted emailaddress. It is very possible that my code is far from optimal (just started developing in .Net) but is this the right way of doing it? Maby i should move the email check to the votingpage, like in a custom fieldtype. But then i would still need to loop through all records..
I would very much like to see some decent sample code for looping approved records and checking the email address. (I'm not using linq, should i?)
Any tips are much appreciated!
Kind regards,
Harm
Comment author was deleted
Hi Harm,
Sounds like a good way of doing it but you can probably improve the code. Do you mind sharing the snippet?
Thanks for the comment Tim, here's the code for the confirmation control.
Like i said, i've just started developing in .Net so there's probably a lot that can be improved but the important thing is that it's way to slow.
Narrowed down to this code it's still way too slow:
Sorry to bump this but i am still looking for a way to loop and check a couple thousand contour records the right way.
Is GetAllRecords the right method for this? I can't specify a pageId because voting takes place on different pages.
Any tips are much appreciated.
Hi There,
I know this is a couple of years after the party, but did you ever find a quicker way of looping through the records?
I'm finding myself in need of looping through 50k+ records. I'm only needing to do it once every now and then as I'm using Lucene to index the results for lightning fast searching, but to rebuild the index is stupidly slow.. It's hammerring SQL..
Mark
is working on a reply...