it will result in a two Update activities, one for each cm.save()
Alternatively the sender could parse through the content of sent activity(s) to check if content has already been delivered (#249 (closed) ) before sending. This would be O(N) to the number of activities which are parsed, although it could be limited drastically by checking only those sent to the target inbox, within some time frame.
EDIT: I've thought of an O(1) solution which may be a lot simpler:
old_activity=get_most_recent_delivered_activity(target,activity_type)new_activity=build_activity(object,target)ifno_new_changes(old_activity,new_activity):# no need to send an activityreturnsend_activity(new_activity)
no_new_changes would require parsing the activity body into JSON and comparing the old_activity.object state to the new_activity.object
I also considered storing past state of the model in the database but I don't think it makes sense because it implies nothing about the receiver