mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-29 04:05:21 +08:00
updates for re registering names
This commit is contained in:
@@ -10,11 +10,12 @@ import json
|
||||
|
||||
from coinrpc.namecoind_server import NamecoindServer
|
||||
|
||||
from config import NAMECOIND_PORT, NAMECOIND_USER, NAMECOIND_PASSWD
|
||||
from config import NAMECOIND_SERVER, NAMECOIND_PORT, NAMECOIND_USER, NAMECOIND_PASSWD
|
||||
from config_local import MAIN_SERVER, LOAD_SERVERS
|
||||
|
||||
from multiprocessing.pool import ThreadPool
|
||||
|
||||
from commontools import log
|
||||
|
||||
#-----------------------------------
|
||||
def check_address(address):
|
||||
|
||||
@@ -30,7 +31,9 @@ def check_address(address):
|
||||
namecoind = NamecoindServer(server, NAMECOIND_PORT, NAMECOIND_USER, NAMECOIND_PASSWD)
|
||||
|
||||
info = json.loads(namecoind.validate_address(address))
|
||||
except:
|
||||
except Exception as e:
|
||||
log.debug("Error in server %s",server)
|
||||
log.debug(e)
|
||||
return
|
||||
|
||||
if info['ismine'] is True:
|
||||
@@ -55,7 +58,7 @@ def check_address(address):
|
||||
#-----------------------------------
|
||||
def get_server(key):
|
||||
|
||||
namecoind = NamecoindServer(MAIN_SERVER, NAMECOIND_PORT, NAMECOIND_USER, NAMECOIND_PASSWD)
|
||||
namecoind = NamecoindServer(NAMECOIND_SERVER, NAMECOIND_PORT, NAMECOIND_USER, NAMECOIND_PASSWD)
|
||||
|
||||
info = namecoind.name_show(key)
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ def send_update():
|
||||
#-----------------------------------
|
||||
if __name__ == '__main__':
|
||||
|
||||
key = 'u/goldmansachs'
|
||||
key = 'u/onename'
|
||||
log.debug(get_server(key))
|
||||
#value = json.loads('{"next":"u/awright"}')
|
||||
#update_name(key,value)
|
||||
|
||||
@@ -25,7 +25,7 @@ users = remote_db.user
|
||||
old_db = MongoClient(OLD_DB).get_default_database()
|
||||
old_users = old_db.user
|
||||
|
||||
MAX_PENDING_TX = 50
|
||||
MAX_PENDING_TX = 100
|
||||
|
||||
#-----------------------------------
|
||||
def pending_transactions():
|
||||
@@ -53,6 +53,11 @@ if __name__ == '__main__':
|
||||
#ignore_users = ['frm','rfd','meng','bjorn']
|
||||
ignore_users = []
|
||||
|
||||
count_twitter = 0
|
||||
count_github = 0
|
||||
count_website = 0
|
||||
count_bio = 0
|
||||
|
||||
counter = 0
|
||||
|
||||
tx_sent = MAX_PENDING_TX
|
||||
@@ -61,6 +66,7 @@ if __name__ == '__main__':
|
||||
|
||||
if tx_sent >= MAX_PENDING_TX:
|
||||
tx_sent = 0
|
||||
print "check for pending tx"
|
||||
while pending_transactions():
|
||||
print "pending transactions, sleeping ..."
|
||||
sleep(60 * 5)
|
||||
@@ -74,20 +80,29 @@ if __name__ == '__main__':
|
||||
new_user = users.find_one({'username':username})
|
||||
if new_user is not None:
|
||||
print username + " in new DB"
|
||||
process_user(username,profile)
|
||||
tx_sent += 1
|
||||
print '-' * 5
|
||||
continue
|
||||
|
||||
#try:
|
||||
# process_user(username,profile)
|
||||
#except Exception as e:
|
||||
# print e
|
||||
#tx_sent += 1
|
||||
#print '-' * 5
|
||||
#continue
|
||||
|
||||
old_user = old_users.find_one({'username':username})
|
||||
if old_user is not None:
|
||||
print username + " in old DB"
|
||||
profile = get_json(old_user['profile'])
|
||||
if 'twitter' in profile:
|
||||
|
||||
try:
|
||||
process_user(username,profile)
|
||||
tx_sent += 1
|
||||
print '-' * 5
|
||||
except Exception as e:
|
||||
print e
|
||||
|
||||
continue
|
||||
|
||||
print username + " not our user"
|
||||
print '-' * 5
|
||||
print '-' * 5
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ echo "Enter OLD_DB:"
|
||||
read input
|
||||
export OLD_DB=$input
|
||||
|
||||
echo "Enter FRONTEND_APP_SECRET:"
|
||||
echo "Enter FRONTEND_SECRET:"
|
||||
read input
|
||||
export FRONTEND_APP_SECRET=$input
|
||||
export FRONTEND_SECRET=$input
|
||||
|
||||
echo "Enter NAMECOIND_SERVER:"
|
||||
read input
|
||||
|
||||
Reference in New Issue
Block a user