@
willerce 主要的问题在于以下这段代码,自生成ID,但自生成 id 时却没有任何的安全机制,比如用事务保证自生成 id 的唯一性
https://github.com/livid/v2ex/blob/master/main.py#L520member = Member()
q = db.GqlQuery('SELECT * FROM Counter WHERE name = :1', 'member.max')
if (q.count() == 1):
counter = q[0]
counter.value = counter.value + 1
else:
counter = Counter()
counter.name = 'member.max'
counter.value = 1
q2 = db.GqlQuery('SELECT * FROM Counter WHERE name = :1', 'member.total')
if (q2.count() == 1):
counter2 = q2[0]
counter2.value = counter2.value + 1
else:
counter2 = Counter()
counter2.name = 'member.total'
counter2.value = 1
member.num = counter.value