Currently, the export will hit the disqus servers at least twice for every comment, which can be VERY slow.
Its doing this because its checking, every time, if there is a thread on disqus for the comments parent node. Which is fine if you only have 1 comment per node, but as soon as you get nodes with a few comments (or perhaps 300) it gets really heavy.
To fix this all we need to do is create a NID => Thread mapping array and consult that before we hit disqus's servers.
Optionally, we should also alter the comment query to be orded by n.created (not c.timestamp), so comments created on the same node, are listed together and processed together. As this will reduce the frequency of hits to Disqus's servers and insure nodes are completely migrated before moving on to the next one.
Will upload a patch once i've backed out the other changes.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | disqusing.patch | 2.51 KB | robloach |
| #2 | disqus_migrate-improvments-987258.patch | 2.36 KB | a_c_m |
Comments
Comment #1
a_c_m commentedwhoops, 6.x not 7.x
Comment #2
a_c_m commentedSo 3 changes in this patch.
1) Ordering of the comments by n.created instead of c.timestamp, so nodes are fully migrated as a unit
2) NID -> Thread mapping, reducing the number of queries to Disqus
3) 'name' generation from email address and auto-skip if we dont have both (its a requirement by Disqus).
Comment #3
rootworkThis sounds excellent. As soon as I have a moment to test this out, I will. In the meantime: Subscribe!
Comment #4
robloachIs there anything to note before committing this? Think it's good to go in? I'm going through a issue review making a 1.7 Disqus release.
Comment #5
rootworkOops -- yes, sorry for not commenting back. I didn't do extensive testing, but as far as I could tell this worked as advertised. RTBC as far as I'm concerned.
Comment #6
robloachUpdated to latest DRUPAL-6--1.... Mind testing?
Comment #7
davidseth commentedI can confirm that this patch did work for me for exporting from Drupal comments to Disqus comments. It fixes issue: http://drupal.org/node/777842 for me.
Comment #8
robloachThanks! http://drupal.org/cvs?commit=490040
I used the follow as davidseth suggested at http://drupal.org/node/777842#comment-4008022 :
Comment #10
netikseo commentedHi, I'm using 6.x-1.9 version of Disqus module and when I'm trying to export my comments I get the error which suppose to be fixed:
Fatal error: Uncaught DisqusException: [0]: There was an error querying the Disqus API. thrown in /var/www/vhosts/-hidden-/httpdocs/sites/all/modules/disqus/disqus.php on line 344
I'm using Drupal 6.27 and it's first time I tried to install Disqus. Anyone else having the same mistake? Any suggestions how to fix it?
Thanks!
Comment #11
netikseo commentedI think I should change status to active as well...
Comment #12
josh@pixael.com commentedSame problem here...
Comment #13
Tresler commentedI'm hitting the same error while handling an export, but the cause is different.
The Disqus API is intermittently throwing an http 500 error, which will cause this exception (although other things will also cause this exception).
For some reason, I'm having issues catching this exception when encapsulating the calling statement in a try{}catch{} block, and I don't know why that is.
Comment #14
the_g_bomb commentedI have uploaded a patch to #2185007: Error during export: You must be authenticated to perform this action which patches the dev version and solves migration issues for me.