send DBE_PROPERTY events only if property field actually changed
This commit is contained in:
@ -22,6 +22,11 @@ should also be read to understand what has changed since earlier releases:
|
||||
|
||||
## Changes made on the 7.0 branch since 7.0.8.1
|
||||
|
||||
### DBE_PROPERTY event rate changed
|
||||
|
||||
Updating property fields now only post DBE_PROPERTY events if the
|
||||
field actually changed.
|
||||
|
||||
### Allow users to delete previously created records from the database
|
||||
|
||||
From this release, record instances and aliases that have already been loaded
|
||||
|
@ -1325,6 +1325,7 @@ long dbPut(DBADDR *paddr, short dbrType,
|
||||
long status = 0;
|
||||
dbFldDes *pfldDes;
|
||||
int isValueField;
|
||||
int propertyUpdate = paddr->pfldDes->prop && precord->mlis.count;
|
||||
|
||||
if (special == SPC_ATTRIBUTE)
|
||||
return S_db_noMod;
|
||||
@ -1369,8 +1370,22 @@ long dbPut(DBADDR *paddr, short dbrType,
|
||||
if (nRequest < 1) {
|
||||
recGblSetSevr(precord, LINK_ALARM, INVALID_ALARM);
|
||||
} else {
|
||||
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
|
||||
paddr->pfield, paddr);
|
||||
if (propertyUpdate && paddr->field_size <= MAX_STRING_SIZE) {
|
||||
char propBuffer[MAX_STRING_SIZE];
|
||||
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
|
||||
&propBuffer, paddr);
|
||||
if (!status) {
|
||||
if (memcmp(paddr->pfield, &propBuffer, paddr->field_size) != 0) {
|
||||
memcpy(paddr->pfield, &propBuffer, paddr->field_size);
|
||||
} else {
|
||||
/* suppress DBE_PROPERTY event if property did not change */
|
||||
propertyUpdate = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
|
||||
paddr->pfield, paddr);
|
||||
}
|
||||
nRequest = 1;
|
||||
}
|
||||
}
|
||||
@ -1391,11 +1406,7 @@ long dbPut(DBADDR *paddr, short dbrType,
|
||||
if (precord->mlis.count &&
|
||||
!(isValueField && pfldDes->process_passive))
|
||||
db_post_events(precord, pfieldsave, DBE_VALUE | DBE_LOG);
|
||||
/* If this field is a property (metadata) field,
|
||||
* then post a property change event (even if the field
|
||||
* didn't change).
|
||||
*/
|
||||
if (precord->mlis.count && pfldDes->prop)
|
||||
if (propertyUpdate)
|
||||
db_post_events(precord, NULL, DBE_PROPERTY);
|
||||
done:
|
||||
paddr->pfield = pfieldsave;
|
||||
|
Reference in New Issue
Block a user