Giter Site home page Giter Site logo

非常态的提交间隔 about ghsp2ofer HOT 3 OPEN

selain avatar selain commented on July 20, 2024
非常态的提交间隔

from ghsp2ofer.

Comments (3)

ladykiki avatar ladykiki commented on July 20, 2024

期望如果可以区分时间段不进行动作.像是 pm 9:00 - am. 10:00 不动作. 拟真点.

from ghsp2ofer.

seLain avatar seLain commented on July 20, 2024

@samjazz @ladykiki
直接可以想到的有兩種做法, (1) 在目前的 settings.py 中增加比較複雜的設定, 在規定的時間內才進行 random 選擇觸發時間, (2) 開始建立 bot profile, 讓 bot 依據 profile 發生行為.

any suggestions for better practice ?

from ghsp2ofer.

seLain avatar seLain commented on July 20, 2024

@ladykiki 已在 settings.py 中加上相關設定.

# WaitStrategy selection. The value must be one of the concrete wait strategies in wait_strategy.py
WAIT_STRATEGY = 'RandomWorkHourStrategy'

# Random commit interval
RANDOM_MIN_MINUTES = 60
RANDOM_MAX_MINUTES = 120

# Bot working hours
WORK_HOURS = [9, 18] # from 9:00AM~6:00PM

WAIT_STRATEGY 使用 RandomWorkHourStrategy 時, WORK_HOURS 設定可以發揮作用. 下一次進行動作的時間保證在此工作時間區間內.

但若 RANDOM_MIN_MINUTES 以及 RANDOM_MAX_MINUTES 設置的太小, 導致無法得到位於 WORK_HOURS 內的時間, 則 bot 會出現 exception 而停下. 舉例而言, 當現在時間是 4:00 AM, 但 RANDOM_MIN_MINUTES = 60, RANDOM_MAX_MINUTES = 120, 則無論如何都無法得到 WORK_HOURS = [9, 18] 的區間內時間, 那麼會丟出 exception 停下.

from ghsp2ofer.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.