Skip to content

Commit

Permalink
[Mod] Set timeout for google api
Browse files Browse the repository at this point in the history
  • Loading branch information
konono committed Feb 7, 2022
1 parent 5fb2373 commit a28c9dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions holoscope/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import importlib
import json
import logging
import socket

from apiclient.discovery import build
from holoscope.config import ConfigLoader
Expand All @@ -16,6 +17,8 @@
EXPOTER_PLUGIN_DIR = "holoscope.exporter_plugin"

log = logging.getLogger(__name__)
timeout_in_sec = 5
socket.setdefaulttimeout(timeout_in_sec)


class Holoscope(object):
Expand Down
4 changes: 3 additions & 1 deletion holoscope/exporter_plugin/google_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import os.path
import pickle
import socket
import textwrap

from ..datamodel import GCalEvent
Expand All @@ -18,8 +19,9 @@
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError


log = logging.getLogger(__name__)
timeout_in_sec = 5
socket.setdefaulttimeout(timeout_in_sec)

CALENDAR_API_SERVICE_NAME = 'calendar'
CALENDAR_API_VERSION = 'v3'
Expand Down

0 comments on commit a28c9dc

Please sign in to comment.