(self, parent_id, key, minutes=60)
Set blob expiration to some minutes from now

        This makes it easy to handle the scenario where a new blob is
        replacing another (now obsolete) blob, but immediate deletion of
        the obsolete blob would introduce a race condition because in-
        flight code may retain references to it. This will schedule the
        obsolete blob for deletion in the near future at which point
        such a race condition is extremely unlikely to be triggered.

        :param parent_id: Parent identifier used for sharding.
        :param key: Blob key.
        :param minutes: Optional number of minutes from now that
        the blob will be set to expire. The default is 60.
Set blob expiration to some minutes from now
Set blob expiration to some minutes from now
def expire(self, parent_id, key, minutes=60):
        """Set blob expiration to some minutes from now

        This makes it easy to handle the scenario where a new blob is
        replacing another (now obsolete) blob, but immediate deletion of
        the obsolete blob would introduce a race condition because in-
        flight code may retain references to it. This will schedule the
        obsolete blob for deletion in the near future at which point
        such a race condition is extremely unlikely to be triggered.

        :param parent_id: Parent identifier used for sharding.
        :param key: Blob key.
        :param minutes: Optional number of minutes from now that
        the blob will be set to expire. The default is 60.
        """
        try:
            meta = self.get(parent_id=parent_id, key=key)
        except BlobMeta.DoesNotExist:
            return
        if meta.expires_on is None:
            tags = _meta_tags(meta)
            metrics_counter('commcare.temp_blobs.count', tags=tags)
            metrics_counter('commcare.temp_blobs.bytes_added', value=meta.stored_content_length, tags=tags)
        meta.expires_on = _utcnow() + timedelta(minutes=minutes)
        meta.save()
def expire ( self , parent_id , key , minutes = 60 ) : try : meta = self . get ( parent_id = parent_id , key = key ) except BlobMeta . DoesNotExist : return if meta . expires_on is None : tags = _meta_tags ( meta ) metrics_counter ( 'commcare.temp_blobs.count' , tags = tags ) metrics_counter ( 'commcare.temp_blobs.bytes_added' , value = meta . stored_content_length , tags = tags ) meta . expires_on = _utcnow ( ) + timedelta ( minutes = minutes ) meta . save ( )