Permalink
Browse files

Distributed load as evenly as possible

  • Loading branch information...
1 parent 7f46fc5 commit afec54b04b41fefc2af9071868765f5d17ef0d69 @muhuk muhuk committed with Jun 9, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 django_open_inviter/open_inviter.py
@@ -29,11 +29,13 @@
'''
import hashlib
import httplib
-import zlib
+import time
import phpserialize
+import zlib
from django.core.exceptions import ImproperlyConfigured
-from exceptions import LoginFailed, InvalidService, OpenInviterException
from app_settings import ACCOUNTS
+from exceptions import LoginFailed, InvalidService, OpenInviterException
+
class OpenInviter(object):
@@ -116,7 +118,7 @@ def services(self):
return services
def _get_account(self):
- return ACCOUNTS[0]
+ return ACCOUNTS[int(time.time()) % len(ACCOUNTS)]
def _email_to_service(self, email):
'''

0 comments on commit afec54b

Please sign in to comment.