Fix error 500 when importer is longer than 5 seconds. Also eliminates the forced 5 second wait when adding an artist.

This commit is contained in:
Pall Valmundsson
2011-11-06 23:04:28 +00:00
parent 017370d30e
commit fd1a916382
2 changed files with 10 additions and 3 deletions

View File

@@ -68,6 +68,14 @@ def addArtisttoDB(artistid, extrasonly=False):
return
myDB = db.DBConnection()
# We need the current minimal info in the database instantly
# so we don't throw a 500 error when we redirect to the artistPage
controlValueDict = {"ArtistID": artistid}
newValueDict = {"ArtistName": "Artist ID: %s" % (artistid),
"Status": "Loading"}
myDB.upsert("artists", newValueDict, controlValueDict)
artist = mb.getArtist(artistid, extrasonly)
@@ -309,4 +317,4 @@ def addReleaseById(rid):
logger.error("ReleaseGroup does not exist in the database and did not get a valid response from MB. Skipping release.")
return
else:
logger.info('Release ' + str(rid) + " already exists in the database!")
logger.info('Release ' + str(rid) + " already exists in the database!")

View File

@@ -70,7 +70,6 @@ class WebInterface(object):
def addArtist(self, artistid):
threading.Thread(target=importer.addArtisttoDB, args=[artistid]).start()
time.sleep(5)
threading.Thread(target=lastfm.getSimilar).start()
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % artistid)
addArtist.exposed = True
@@ -495,4 +494,4 @@ class WebInterface(object):
lastfm.getSimilar()
raise cherrypy.HTTPRedirect("extras")
updateCloud.exposed = True
updateCloud.exposed = True