Skip to content

Commit

Permalink
Use a UUID (rather than a sentinel object) for sentinel on Pub / Sub …
Browse files Browse the repository at this point in the history
…`Future`.
  • Loading branch information
dhermes committed Dec 20, 2017
1 parent a62931a commit c5c7971
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pubsub/google/cloud/pubsub_v1/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import absolute_import

import threading
import uuid

import google.api_core.future
from google.cloud.pubsub_v1.publisher import exceptions
Expand All @@ -29,7 +30,11 @@ class Future(google.api_core.future.Future):
This object should not be created directly, but is returned by other
methods in this library.
"""
_SENTINEL = object()

# This could be a sentinel object or None, but the sentinel object's ID
# can change if the process is forked, and None has the possibility of
# actually being a result.
_SENTINEL = uuid.uuid4()

def __init__(self):
self._result = self._SENTINEL
Expand Down

0 comments on commit c5c7971

Please sign in to comment.