Remove stupid cycling UUID scheme. Instead, limit server-side pin deduping to a single instance.
This commit is contained in:
@@ -230,6 +230,7 @@ class Subject(db.Model):
|
|||||||
Pin.all()
|
Pin.all()
|
||||||
.ancestor(subject)
|
.ancestor(subject)
|
||||||
.filter('sender_message_id =', sender_message_id)
|
.filter('sender_message_id =', sender_message_id)
|
||||||
|
.filter('instance =', instance)
|
||||||
.fetch(1))
|
.fetch(1))
|
||||||
if pins:
|
if pins:
|
||||||
raise DuplicateMessage(sender_message_id)
|
raise DuplicateMessage(sender_message_id)
|
||||||
|
|||||||
@@ -403,9 +403,10 @@ Cosmopolite.prototype.pin = function(subject, message) {
|
|||||||
*/
|
*/
|
||||||
Cosmopolite.prototype.unpin = function(id) {
|
Cosmopolite.prototype.unpin = function(id) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
|
var pin = this.pins_[id];
|
||||||
var args = {
|
var args = {
|
||||||
'subject': this.pins_[id]['subject'],
|
'subject': pin['subject'],
|
||||||
'sender_message_id': id,
|
'sender_message_id': pin['sender_message_id'],
|
||||||
};
|
};
|
||||||
|
|
||||||
delete this.pins_[id];
|
delete this.pins_[id];
|
||||||
@@ -768,7 +769,6 @@ Cosmopolite.prototype.onReconnect_ = function() {
|
|||||||
for (var id in this.pins_) {
|
for (var id in this.pins_) {
|
||||||
/** @type {typeMessage} */
|
/** @type {typeMessage} */
|
||||||
var pin = this.pins_[id];
|
var pin = this.pins_[id];
|
||||||
pin['sender_message_id'] = this.uuid_();
|
|
||||||
rpcs.push({
|
rpcs.push({
|
||||||
'command': 'pin',
|
'command': 'pin',
|
||||||
'arguments': pin,
|
'arguments': pin,
|
||||||
|
|||||||
Reference in New Issue
Block a user