Optimize dependency requirements in pubsub hook.