Attachment listeners triggered before a new attachment version uploaded and stored in Confluence

Hello, we discovered the problem: attachment listeners triggered before the new attachment version uploaded and stored in Confluence (we discovered this problem in Confluence, but it probably also exists in Jira). I.e. we try to call attachmentManager.getAttachment(id); in the com.atlassian.confluence.event.events.content.attachment.AttachmentUpdateEvent listener and sometimes it returns attachment, but sometimes returns null for some reason which is probably because the listener has been triggered earlier than attachment has been added to DB. How to deal with this problem? Maybe there is some cache that needs to be refreshed or indexing that needs to complete? I actually reproduced this in Confluence Data Center, because Confluence server versions are not supported now.

1 Like