Fix release from #1860 (hotfix #1934).

- Cron job to send weekly email report is processed multiple times. Review scheduling process to send to only one worker.
- Implement mechanism to ensure each email is sent only once to each recipient.
- Improve the way the async task is processed by creating a separate task for each organization, instead of processing all organizations in a single task.
posthog/settings.py
]
SOCIAL_AUTH_GITHUB_SCOPE = ["user:email"]
SOCIAL_AUTH_GITHUB_KEY = os.environ.get("SOCIAL_AUTH_GITHUB_KEY", "")
SOCIAL_AUTH_GITHUB_SECRET = os.environ.get("SOCIAL_AUTH_GITHUB_SECRET", "")
SOCIAL_AUTH_GITLAB_SCOPE = ["read_user"]
SOCIAL_AUTH_GITLAB_KEY = os.environ.get("SOCIAL_AUTH_GITLAB_KEY", "")
SOCIAL_AUTH_GITLAB_SECRET = os.environ.get("SOCIAL_AUTH_GITLAB_SECRET", "")
SOCIAL_AUTH_GITLAB_API_URL = os.environ.get("SOCIAL_AUTH_GITLAB_API_URL", "https://gitlab.com")
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
if TEST or DEBUG:
    DATABASE_URL = os.environ.get("DATABASE_URL", "postgres://localhost:5432/posthog")
else:
    DATABASE_URL = os.environ.get("DATABASE_URL", "")
if DATABASE_URL:
    DATABASES = {"default": dj_database_url.config(default=DATABASE_URL, conn_max_age=600)}
elif os.environ.get("POSTHOG_DB_NAME"):
    DATABASES = {
        "default": {
            "ENGINE": "django.db.backends.postgresql_psycopg2",
            "NAME": get_env("POSTHOG_DB_NAME"),
            "USER": os.environ.get("POSTHOG_DB_USER", "postgres"),
            "PASSWORD": os.environ.get("POSTHOG_DB_PASSWORD", ""),
            "HOST": os.environ.get("POSTHOG_POSTGRES_HOST", "localhost"),
            "PORT": os.environ.get("POSTHOG_POSTGRES_PORT", "5432"),
            "CONN_MAX_AGE": 0,
        }
    }
else:
    raise ImproperlyConfigured(