rejectTaskPluginRoutingConflict answers the request and returns true when the plugin about to serve key fails to compile or does not fit the live routing generation: row as the key's active version switched on, or the factory built-in when row is nil. A key without a built-in to fall back to has not
(c *gin.Context, key string, row *model.TaskPlugin)
| 834 | // has nothing to check. Keeping every enabled plugin conflict-free leaves the |
| 835 | // restart order nothing to decide. |
| 836 | func rejectTaskPluginRoutingConflict(c *gin.Context, key string, row *model.TaskPlugin) bool { |
| 837 | var candidate *jsplugin.LoadedPlugin |
| 838 | var err error |
| 839 | if row != nil { |
| 840 | candidate, err = jsplugin.CompilePlugin(string(row.Source), jsplugin.Options{Key: row.Key, Version: row.Version}) |
| 841 | } else if taskPluginHasFactory(key) { |
| 842 | var source string |
| 843 | if source, err = plugins.Source(key); err == nil { |
| 844 | candidate, err = jsplugin.CompilePlugin(source, jsplugin.Options{Key: key}) |
| 845 | } |
| 846 | } |
| 847 | if err != nil { |
| 848 | taskPluginCompileError(c, err) |
| 849 | return true |
| 850 | } |
| 851 | if candidate == nil { |
| 852 | return false |
| 853 | } |
| 854 | if err = jsplugin.PreflightRoutingConflict(jsplugin.DefaultRegistry.Generation(), candidate); err != nil { |
| 855 | common.ApiErrorMsg(c, err.Error()) |
| 856 | return true |
| 857 | } |
| 858 | return false |
| 859 | } |
| 860 | |
| 861 | // taskPluginPricingIssues lists, after the registry sync, the task model prices |
| 862 | // the plugin serving key cannot charge. The plugin change is already saved, so |
no test coverage detected